Opened 15 years ago

Closed 14 years ago

Last modified 13 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: no UI/UX: no

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

Download all attachments as: .zip

Change History (11)

comment:1 by Russell Keith-Magee, 15 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 by eternicode, 14 years ago

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 by Russell Keith-Magee, 14 years ago

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 by eternicode, 14 years ago

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

comment:5 by Gabriel Hurley, 14 years ago

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.

by Gabriel Hurley, 14 years ago

New patch with docs and tests

comment:6 by Gabriel Hurley, 14 years ago

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 by Thejaswi Puthraya, 14 years ago

Keywords: sprintnov13 added

This patch applies cleanly and all tests pass.

comment:8 by Jannis Leidel, 14 years ago

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 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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