Show "moderate comments" link in the admin panel only if a moderation workflow is enabled for comments.
svn path=/plone.app.discussion/trunk/; revision=46206
This commit is contained in:
parent
6e354718f4
commit
583b25530e
@ -4,6 +4,10 @@ Changelog
|
||||
1.0RC1 (unreleased)
|
||||
-------------------
|
||||
|
||||
- Show "moderate comments" link in the admin panel only if a moderation
|
||||
workflow is enabled for comments.
|
||||
[timo]
|
||||
|
||||
- Do not allow to change the mail settings in the discussion control panel, if
|
||||
there is no valid mail setup.
|
||||
[timo]
|
||||
|
@ -54,6 +54,23 @@
|
||||
permission="plone.app.discussion.ReviewComments"
|
||||
/>
|
||||
|
||||
<!-- Moderate comments enabled view -->
|
||||
<browser:page
|
||||
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
|
||||
name="moderate-comments-enabled"
|
||||
layer="..interfaces.IDiscussionLayer"
|
||||
class=".moderation.ModerateCommentsEnabled"
|
||||
permission="zope2.View"
|
||||
/>
|
||||
|
||||
<browser:page
|
||||
for="plone.app.layout.navigation.interfaces.INavigationRoot"
|
||||
name="moderate-comments-enabled"
|
||||
layer="..interfaces.IDiscussionLayer"
|
||||
class=".moderation.ModerateCommentsEnabled"
|
||||
permission="zope2.View"
|
||||
/>
|
||||
|
||||
<!-- Delete comment view -->
|
||||
<browser:page
|
||||
for="plone.app.discussion.interfaces.IComment"
|
||||
|
@ -75,6 +75,23 @@ class View(BrowserView):
|
||||
return False
|
||||
|
||||
|
||||
class ModerateCommentsEnabled(BrowserView):
|
||||
|
||||
def __call__(self):
|
||||
"""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', None)
|
||||
comment_workflow = wf_tool.getChainForPortalType('Discussion Item')[0]
|
||||
comment_workflow = wf_tool[comment_workflow]
|
||||
if 'pending' in comment_workflow.states:
|
||||
return True
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
class DeleteComment(BrowserView):
|
||||
"""Delete a comment from a conversation.
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<property name="description" i18n:translate=""></property>
|
||||
<property name="url_expr">string:${globals_view/navigationRootUrl}/@@moderate-comments</property>
|
||||
<property name="icon_expr"></property>
|
||||
<property name="available_expr"></property>
|
||||
<property name="available_expr">portal/@@moderate-comments-enabled|nothing</property>
|
||||
<property name="permissions">
|
||||
<element value="Review comments"/>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user