Code

Opened 5 years ago

Closed 5 years ago

#11174 closed (invalid)

CommentModerator's moderate_after does not accept 0.

Reported by: andrepleblanc@… Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

the CommentModerator has two fields which together allow you to make comments default to non-public X-days after the related object is posted. however, it doesn't allow for that X to be zero.

from django/contrib/comments/moderation.py:223
if self.auto_moderate_field and self.moderate_after:
should probably read:
if self.auto_moderate_field and self.moderate_after is not None:

this would allow for comments to always be moderated. (perhaps I'm missing the "correct" way to have all comments non-public by default. but none the less, the principle of least surprise says that this should work with a zero.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

The correct solution is to write a subclass of CommentModerator which overrides the moderate() method to always return True (see the documentation for details). Supporting a zero-length period in which comments can be posted unmoderated really isn't something that should work here.

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.