Make comments editable

This commit is contained in:
Guido A.J. Stevens
2014-05-15 17:50:32 +02:00
committed by Andrea Cecchi
parent 2b18d5a2e4
commit a82352a36c
20 changed files with 359 additions and 10 deletions
+13
View File
@@ -317,6 +317,13 @@ class CommentsViewlet(ViewletBase):
return getSecurityManager().checkPermission('Review comments',
aq_inner(self.context))
def can_edit(self, reply):
"""Returns true if current user has the 'Delete objects'
permission.
"""
return getSecurityManager().checkPermission('Edit comments',
aq_inner(reply))
def is_discussion_allowed(self):
context = aq_inner(self.context)
return context.restrictedTraverse('@@conversation_view').enabled()
@@ -442,6 +449,12 @@ class CommentsViewlet(ViewletBase):
settings = registry.forInterface(IDiscussionSettings, check=False)
return settings.anonymous_comments
def edit_comment_allowed(self):
# Check if editing comments is allowed in the registry
registry = queryUtility(IRegistry)
settings = registry.forInterface(IDiscussionSettings, check=False)
return settings.edit_comment_enabled
def show_commenter_image(self):
# Check if showing commenter image is enabled in the registry
registry = queryUtility(IRegistry)