From 2a8082cfa7d37c8c247f1a105b7e027cde5e0940 Mon Sep 17 00:00:00 2001 From: Vincent Fretin Date: Sat, 20 Sep 2014 16:02:48 +0200 Subject: [PATCH] add delete_own_comment_enabled option in control panel --- plone/app/discussion/browser/comments.pt | 3 ++- plone/app/discussion/browser/comments.py | 10 ++++++++-- plone/app/discussion/browser/controlpanel.py | 5 +++++ .../discussion/browser/javascripts/controlpanel.js | 2 ++ plone/app/discussion/browser/moderation.py | 8 ++++---- plone/app/discussion/configure.zcml | 8 ++++---- plone/app/discussion/interfaces.py | 13 ++++++++++++- plone/app/discussion/profiles/default/registry.xml | 1 + plone/app/discussion/tests/test_controlpanel.py | 8 ++++---- 9 files changed, 42 insertions(+), 16 deletions(-) diff --git a/plone/app/discussion/browser/comments.pt b/plone/app/discussion/browser/comments.pt index ceb50de..8e69b15 100644 --- a/plone/app/discussion/browser/comments.pt +++ b/plone/app/discussion/browser/comments.pt @@ -2,6 +2,7 @@ isDiscussionAllowed view/is_discussion_allowed; isAnonymousDiscussionAllowed view/anonymous_discussion_allowed; isEditCommentAllowed view/edit_comment_allowed; + isDeleteOwnCommentAllowed view/delete_own_comment_allowed; isAnon view/is_anonymous; canReview view/can_review; replies python:view.get_replies(canReview); @@ -90,7 +91,7 @@ action="" method="post" class="commentactionsform" - tal:condition="python: not canDelete and view.could_delete_own(reply)" + tal:condition="python:not canDelete and isDeleteOwnCommentAllowed and view.could_delete_own(reply)" tal:attributes="action string:${reply/absolute_url}/@@delete-own-comment; style python:view.can_delete_own(reply) and 'display: inline' or 'display: none'"> False + False diff --git a/plone/app/discussion/tests/test_controlpanel.py b/plone/app/discussion/tests/test_controlpanel.py index 8a2ba47..d672167 100644 --- a/plone/app/discussion/tests/test_controlpanel.py +++ b/plone/app/discussion/tests/test_controlpanel.py @@ -89,12 +89,12 @@ class RegistryTest(unittest.TestCase): 'IDiscussionSettings.edit_comment_enabled'], False) - def test_edit_comment_enabled(self): - # Check edit_comment_enabled record - self.assertTrue('edit_comment_enabled' in IDiscussionSettings) + def test_delete_own_comment_enabled(self): + # Check delete_own_comment_enabled record + self.assertTrue('delete_own_comment_enabled' in IDiscussionSettings) self.assertEqual( self.registry['plone.app.discussion.interfaces.' + - 'IDiscussionSettings.edit_comment_enabled'], + 'IDiscussionSettings.delete_own_comment_enabled'], False) def test_text_transform(self):