diff --git a/CHANGES.txt b/CHANGES.txt index 5c65aa3..a4c2a8f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,13 +4,10 @@ Changelog 1.0b10 (unreleased) ------------------- -- Check the review_state to decide if moderation is enabled. If the current - comment workflow implements a 'pending' state, moderation is enabled. - [timo] - -- 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. +- Check if there is a 'pending' review state in the current workflow for + comments instead of just checking for the 'comment_review_workflow'. This + allows integrators to use a custom review workflow. This fixes + http://dev.plone.org/plone/ticket/11184. [timo] diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 8424f68..3d43266 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -242,10 +242,11 @@ def notify_moderator(obj, event): if not settings.moderator_notification_enabled: return - # Check if comment review workflow is enabled - wf = getToolByName(obj, 'portal_workflow') - if wf.getChainForPortalType('Discussion Item') != \ - ('comment_review_workflow',): + # Check if the current workflow implements a pending state. + wf_tool = getToolByName(obj, 'portal_workflow') + comment_workflow = wf_tool.getChainForPortalType('Discussion Item')[0] + comment_workflow = wf_tool[comment_workflow] + if 'pending' not in comment_workflow.states: return # Get informations that are necessary to send an email diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index e285531..e2b18a7 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -239,7 +239,7 @@ class TestModeratorNotificationUnit(PloneTestCase): self.portal.portal_types['Document'].allow_discussion = True self.portal.portal_workflow.setChainForPortalTypes( ('Discussion Item',), - ('simple_publication_workflow',)) + ('one_state_workflow',)) comment = createObject('plone.Comment') comment.title = 'Comment 1'