Check the review_state instead of the workflow after a comment has been posted to decide if a message is shown to the user. This allows integrators to use custom review workflows. Refs #11184

svn path=/plone.app.discussion/trunk/; revision=40566
This commit is contained in:
Timo Stollenwerk 2010-10-08 09:53:00 +00:00
parent aea10731cd
commit 2790e6d4eb
2 changed files with 9 additions and 6 deletions

View File

@ -4,7 +4,10 @@ Changelog
1.0b10 (unreleased) 1.0b10 (unreleased)
------------------- -------------------
- Nothing changed yet. - Check the review_state instead of the workflow after a comment has been
posted to decide if a message is shown to the user. This allows integrators
to use custom review workflows.
[timo]
1.0b9 (2010-10-07) 1.0b9 (2010-10-07)

View File

@ -191,13 +191,13 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
# Add a comment to the conversation # Add a comment to the conversation
comment_id = conversation.addComment(comment) comment_id = conversation.addComment(comment)
# If a user post a comment and moderation is enabled, a message is shown # If a user posts a comment and moderation is enabled, a message is
# to the user that his/her comment awaits moderation. If the user has # shown to the user that his/her comment awaits moderation. If the user
# manage right, he/she is redirected directly to the comment. # has manage right, he/she is redirected directly to the comment.
can_manage = getSecurityManager().checkPermission('Manage portal', can_manage = getSecurityManager().checkPermission('Manage portal',
context) context)
if wf.getChainForPortalType('Discussion Item') == \ comment_review_state = wf.getInfoFor(comment, 'review_state')
('comment_review_workflow',) and not can_manage: if comment_review_state == 'pending' and not can_manage:
# Show info message when comment moderation is enabled # Show info message when comment moderation is enabled
IStatusMessage(self.context.REQUEST).addStatusMessage( IStatusMessage(self.context.REQUEST).addStatusMessage(
_("Your comment awaits moderator approval."), _("Your comment awaits moderator approval."),