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)
-------------------
- 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]

View File

@ -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

View File

@ -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'