Check for a 'pending' state in the current comment workflow instead of checking for the 'comment_review' workflow. Refs #11184. Merge last three submits in CHANGES.txt.

svn path=/plone.app.discussion/trunk/; revision=40570
This commit is contained in:
Timo Stollenwerk 2010-10-08 10:37:10 +00:00
parent 6e9bb4a9cd
commit 324d2274bd
3 changed files with 10 additions and 12 deletions

View File

@ -4,13 +4,10 @@ Changelog
1.0b10 (unreleased) 1.0b10 (unreleased)
------------------- -------------------
- Check the review_state to decide if moderation is enabled. If the current - Check if there is a 'pending' review state in the current workflow for
comment workflow implements a 'pending' state, moderation is enabled. comments instead of just checking for the 'comment_review_workflow'. This
[timo] allows integrators to use a custom review workflow. This fixes
http://dev.plone.org/plone/ticket/11184.
- 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] [timo]

View File

@ -242,10 +242,11 @@ def notify_moderator(obj, event):
if not settings.moderator_notification_enabled: if not settings.moderator_notification_enabled:
return return
# Check if comment review workflow is enabled # Check if the current workflow implements a pending state.
wf = getToolByName(obj, 'portal_workflow') wf_tool = getToolByName(obj, 'portal_workflow')
if wf.getChainForPortalType('Discussion Item') != \ comment_workflow = wf_tool.getChainForPortalType('Discussion Item')[0]
('comment_review_workflow',): comment_workflow = wf_tool[comment_workflow]
if 'pending' not in comment_workflow.states:
return return
# Get informations that are necessary to send an email # Get informations that are necessary to send an email

View File

@ -239,7 +239,7 @@ class TestModeratorNotificationUnit(PloneTestCase):
self.portal.portal_types['Document'].allow_discussion = True self.portal.portal_types['Document'].allow_discussion = True
self.portal.portal_workflow.setChainForPortalTypes( self.portal.portal_workflow.setChainForPortalTypes(
('Discussion Item',), ('Discussion Item',),
('simple_publication_workflow',)) ('one_state_workflow',))
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.title = 'Comment 1' comment.title = 'Comment 1'