Do not check for a comment review workflow when sending out a moderator email notification. This fixes http://dev.plone.org/plone/ticket/11444. Refs #11444

svn path=/plone.app.discussion/trunk/; revision=47292
This commit is contained in:
Timo Stollenwerk 2011-02-07 11:48:24 +00:00
parent 39beac094c
commit 0a0e69d47d
3 changed files with 3 additions and 20 deletions

View File

@ -22,6 +22,9 @@ Changelog
Plone 4.1. Plone 4.1.
[timo] [timo]
- Do not check for a comment review workflow when sending out a moderator email
notification. This fixes http://dev.plone.org/plone/ticket/11444.
1.0RC1 (unreleased) 1.0RC1 (unreleased)
------------------- -------------------

View File

@ -284,13 +284,6 @@ def notify_moderator(obj, event):
if not settings.moderator_notification_enabled: if not settings.moderator_notification_enabled:
return return
# 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 # Get informations that are necessary to send an email
mail_host = getToolByName(obj, 'MailHost') mail_host = getToolByName(obj, 'MailHost')
portal_url = getToolByName(obj, 'portal_url') portal_url = getToolByName(obj, 'portal_url')

View File

@ -256,18 +256,5 @@ class TestModeratorNotificationUnit(PloneTestCase):
self.conversation.addComment(comment) self.conversation.addComment(comment)
self.assertEquals(len(self.mailhost.messages), 0) self.assertEquals(len(self.mailhost.messages), 0)
def test_do_not_notify_moderator_when_moderation_workflow_is_disabled(self):
# Disable comment moderation and make sure no email is send to the
# moderator.
self.portal.portal_types['Document'].allow_discussion = True
self.portal.portal_workflow.setChainForPortalTypes(
('Discussion Item',),
('one_state_workflow',))
comment = createObject('plone.Comment')
comment.text = 'Comment text'
self.conversation.addComment(comment)
self.assertEquals(len(self.mailhost.messages), 0)
def test_suite(): def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__) return unittest.defaultTestLoader.loadTestsFromName(__name__)