Check the review_state to decide if moderation is enabled. If the current comment workflow implements a 'pending' state, moderation is enabled. Refs #11184.
svn path=/plone.app.discussion/trunk/; revision=40569
This commit is contained in:
@@ -61,13 +61,15 @@ class View(BrowserView):
|
||||
return text
|
||||
|
||||
def moderation_enabled(self):
|
||||
"""Returns true if comment moderation workflow is
|
||||
enabled on 'Discussion Item' content type.
|
||||
"""Returns true if a 'review workflow' is enabled on 'Discussion Item'
|
||||
content type. A 'review workflow' is characterized by implementing
|
||||
a 'pending' workflow state.
|
||||
"""
|
||||
context = aq_inner(self.context)
|
||||
wf_tool = getToolByName(context, 'portal_workflow')
|
||||
if wf_tool.getChainForPortalType('Discussion Item') \
|
||||
== ('comment_review_workflow',):
|
||||
comment_workflow = wf_tool.getChainForPortalType('Discussion Item')[0]
|
||||
comment_workflow = wf_tool[comment_workflow]
|
||||
if 'pending' in comment_workflow.states:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user