Do not show "publish" bulk action in moderation view when moderation is disabled. Fix story 1105355
. svn path=/plone.app.discussion/trunk/; revision=30678
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
Batch python:modules['Products.CMFPlone'].Batch;
|
||||
b_size python:30;
|
||||
b_start python:0;
|
||||
b_start request/b_start | b_start;">
|
||||
b_start request/b_start | b_start;
|
||||
moderation_enabled view/moderation_enabled;">
|
||||
|
||||
<h1 class="documentFirstHeading" i18n:translate="title_review">
|
||||
Moderate comments
|
||||
@@ -79,7 +80,7 @@
|
||||
<!--<option value="retract" i18n:translate="bulkactions_retract">Retract</option>-->
|
||||
<option value="publish"
|
||||
i18n:translate="bulkactions_publish"
|
||||
tal:condition="python: filter != 'published'">Publish</option>
|
||||
tal:condition="python: filter != 'published' and moderation_enabled">Publish</option>
|
||||
<!--<option value="mark_as_spam" i18n:translate="bulkactions_markasspam">Mark as Spam</option>-->
|
||||
<option value="delete" i18n:translate="bulkactions_delete">Delete</option>
|
||||
</select>
|
||||
|
||||
@@ -41,8 +41,21 @@ class View(BrowserView):
|
||||
def cook(self, text):
|
||||
return text
|
||||
|
||||
def comments_all(self, start=0, size=None):
|
||||
def moderation_enabled(self):
|
||||
"""Returns true if comment moderation workflow is
|
||||
enabled on 'Discussion Item' content type.
|
||||
"""
|
||||
context = aq_inner(self.context)
|
||||
wf_tool = getToolByName(context, 'portal_workflow')
|
||||
if wf_tool.getChainForPortalType('Discussion Item') \
|
||||
== ('comment_review_workflow',):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def comments_all(self, start=0, size=None):
|
||||
"""Returns all comments.
|
||||
"""
|
||||
self.state = self.request.get('review_state', 'pending')
|
||||
self.transition = self.request.get('publish_transition', 'publish')
|
||||
self.limit = self.request.get('limit', 100)
|
||||
@@ -57,6 +70,8 @@ class View(BrowserView):
|
||||
)
|
||||
|
||||
def comments_pending(self, start=0, size=None):
|
||||
"""Returns all comments with 'pending' review state.
|
||||
"""
|
||||
self.state = self.request.get('review_state', 'pending')
|
||||
self.transition = self.request.get('publish_transition', 'publish')
|
||||
self.limit = self.request.get('limit', 100)
|
||||
@@ -72,7 +87,8 @@ class View(BrowserView):
|
||||
)
|
||||
|
||||
def comments_published(self, start=0, size=None):
|
||||
|
||||
"""Returns all comments with 'published' review state.
|
||||
"""
|
||||
self.state = self.request.get('review_state', 'pending')
|
||||
self.transition = self.request.get('publish_transition', 'pending')
|
||||
self.limit = self.request.get('limit', 100)
|
||||
@@ -88,8 +104,13 @@ class View(BrowserView):
|
||||
)
|
||||
|
||||
def comments_spam(self, start=0, size=None):
|
||||
"""Returns all comments that are marked as spam.
|
||||
|
||||
Not implemented yet.
|
||||
"""
|
||||
return None
|
||||
|
||||
|
||||
class DeleteComment(BrowserView):
|
||||
"""Delete a comment from a conversation
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user