From 2790e6d4ebc592b9d3e5557b357e0e7eb896c135 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Fri, 8 Oct 2010 09:53:00 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 5 ++++- plone/app/discussion/browser/comments.py | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index c5f8e9f..5035dfb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,7 +4,10 @@ Changelog 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) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index ad4cc36..767cc31 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -191,13 +191,13 @@ class CommentForm(extensible.ExtensibleForm, form.Form): # Add a comment to the conversation comment_id = conversation.addComment(comment) - # If a user post a comment and moderation is enabled, a message is shown - # to the user that his/her comment awaits moderation. If the user has - # manage right, he/she is redirected directly to the comment. + # If a user posts a comment and moderation is enabled, a message is + # shown to the user that his/her comment awaits moderation. If the user + # has manage right, he/she is redirected directly to the comment. can_manage = getSecurityManager().checkPermission('Manage portal', context) - if wf.getChainForPortalType('Discussion Item') == \ - ('comment_review_workflow',) and not can_manage: + comment_review_state = wf.getInfoFor(comment, 'review_state') + if comment_review_state == 'pending' and not can_manage: # Show info message when comment moderation is enabled IStatusMessage(self.context.REQUEST).addStatusMessage( _("Your comment awaits moderator approval."),