Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#12325 closed (fixed)

Allow value of zero for moderate_after and close_after

Reported by: zhigang Owned by: gabrielhurley
Component: contrib.comments Version: 1.1
Severity: Keywords: moderation, sprintnov13
Cc: james@…, andrew@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In the current implement, if we want all comments go to approval queue just after a entry is published, you should assign moderate_after a value < 0. But moderate_after = 0 makes more sense. This patch allows this.

Attachments (2)

django-comments-moderation-allow-zero-moderate_after.patch (608 bytes) - added by zhigang 5 years ago.
12325_comment_moderation.diff (4.4 KB) - added by gabrielhurley 4 years ago.
New patch with docs and tests

Download all attachments as: .zip

Change History (11)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by eternicode

  • Cc andrew@… added

Where should tests for this patch go, and what approach should be used for them?

The comments app currently doesn't have *any* tests, and I think this is understandable (not good, just understandable), because the various aspects of the app depend on subclassing (for custom moderation) and other models (for normal commenting).

At any rate, an alternative workaround to using a negative number is to specify a very small number, such as one second:

class MyModerator(CommentModerator):
    auto_moderate_field = 'moderate_after'
    moderate_after = 1.0/86400 # 1 out of the 86,400 seconds in a day

Not as clean as "0", but it's effectively the same and will work until this patch is checked in.

comment:3 Changed 4 years ago by russellm

The comment app does have tests; for historical reasons, they're not under contrib.comments; they're in the regressiontests directory, under comments_tests.

comment:4 Changed 4 years ago by eternicode

Ah, ok, I see them now. Didn't think to look there for them, thanks for the pointer.

comment:5 Changed 4 years ago by gabrielhurley

  • Needs documentation set
  • Owner changed from nobody to gabrielhurley
  • Status changed from new to assigned
  • Summary changed from [PATCH]Allow zero moderate_after time to Allow zero moderate_after time

I'll finish off this patch with tests and a small note about allowed values in the docs... claiming it so I don't forget.

Changed 4 years ago by gabrielhurley

New patch with docs and tests

comment:6 Changed 4 years ago by gabrielhurley

  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Summary changed from Allow zero moderate_after time to Allow value of zero for moderate_after and close_after

Added a new patch which allows 0 as a valid value for both close_after and moderate_after. Includes docs and tests. Passes test suite.

comment:7 Changed 4 years ago by thejaswi_puthraya

  • Keywords moderation, sprintnov13 added; moderation removed

This patch applies cleanly and all tests pass.

comment:8 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14556]) Fixed #12325 -- Allows zero values for moderate_after and close_after fields of comment moderators. Thanks, Gabriel Hurley.

comment:9 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.