diff --git a/CHANGES.txt b/CHANGES.txt index 7329c5d..7fedca1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,13 @@ Changelog 2.0b2 (Unreleased) ------------------ +- Move some policy out of the conversation storage adapter into a + view, specifically "enabled()". Prevents having to replace/migrate + persistent objects to change policy which really only concerns the + context and possibly the request, not the conversation storage. + Fixes #11372. + [rossp] + - Fix unindexing of comments when deleting content resulting from iterating over a BTree while modifying it. Fixes #11402. [rossp] diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 6627987..a6b143f 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -168,14 +168,15 @@ class CommentForm(extensible.ExtensibleForm, form.Form): if 'user_notification' in data: user_notification = data['user_notification'] - # The add-comment view is called on the conversation object - conversation = IConversation(self.__parent__) - # Check if conversation is enabled on this content object - if not conversation.enabled(): + if not self.__parent__.restrictedTraverse( + '@@conversation_view').enabled(): raise Unauthorized, "Discussion is not enabled for this content\ object." + # The add-comment view is called on the conversation object + conversation = IConversation(self.__parent__) + if data['in_reply_to']: # Fetch the comment we want to reply to conversation_to_reply_to = conversation.get(data['in_reply_to']) @@ -291,8 +292,7 @@ class CommentsViewlet(ViewletBase): def is_discussion_allowed(self): context = aq_inner(self.context) - conversation = IConversation(context) - return conversation.enabled() + return context.restrictedTraverse('@@conversation_view').enabled() def comment_transform_message(self): """Returns the description that shows up above the comment text, diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml index 95dbf2e..a240167 100644 --- a/plone/app/discussion/browser/configure.zcml +++ b/plone/app/discussion/browser/configure.zcml @@ -100,6 +100,15 @@ permission="zope2.View" /> + + +