Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#12325 closed (fixed)

Allow value of zero for moderate_after and close_after

Reported by: zhigang Owned by: Gabriel Hurley
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 7 years ago.
12325_comment_moderation.diff (4.4 KB) - added by Gabriel Hurley 6 years ago.
New patch with docs and tests

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by Russell Keith-Magee

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 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 6 years ago by Russell Keith-Magee

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 6 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 6 years ago by Gabriel Hurley

Needs documentation: set
Owner: changed from nobody to Gabriel Hurley
Status: newassigned
Summary: [PATCH]Allow zero moderate_after timeAllow 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 6 years ago by Gabriel Hurley

New patch with docs and tests

comment:6 Changed 6 years ago by Gabriel Hurley

milestone: 1.3
Needs documentation: unset
Needs tests: unset
Summary: Allow zero moderate_after timeAllow 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 6 years ago by Thejaswi Puthraya

Keywords: sprintnov13 added

This patch applies cleanly and all tests pass.

comment:8 Changed 6 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

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

comment:9 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top