Fixed the case where a folder has allow_discussion=False and
conversation.enabled() on a document in this folder returned False instead of True because of allow_discussion acquisition. svn path=/plone.app.discussion/trunk/; revision=38835
This commit is contained in:
parent
01bc4a778a
commit
352a517a0a
@ -4,6 +4,11 @@ Changelog
|
|||||||
1.0b6 (unreleased)
|
1.0b6 (unreleased)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
* Fixed the case where a folder has allow_discussion=False and
|
||||||
|
conversation.enabled() on a document in this folder returned False
|
||||||
|
instead of True because of allow_discussion acquisition.
|
||||||
|
[vincentfretin]
|
||||||
|
|
||||||
* Redirect to the comment form action instead of the absolute url when a
|
* Redirect to the comment form action instead of the absolute url when a
|
||||||
comment is posted. This fixes the accidentially triggered file upload when a
|
comment is posted. This fixes the accidentially triggered file upload when a
|
||||||
comment is posted on a file content object.
|
comment is posted on a file content object.
|
||||||
|
@ -127,7 +127,7 @@ class Conversation(Traversable, Persistent, Explicit):
|
|||||||
obj = aq_parent(self)
|
obj = aq_parent(self)
|
||||||
|
|
||||||
# If discussion is disabled for the object, bail out
|
# If discussion is disabled for the object, bail out
|
||||||
obj_flag = getattr(obj, 'allow_discussion', None)
|
obj_flag = getattr(aq_base(obj), 'allow_discussion', None)
|
||||||
if obj_flag is False:
|
if obj_flag is False:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -215,6 +215,31 @@ class ConversationTest(PloneTestCase):
|
|||||||
self.assertEquals(portal_discussion.isDiscussionAllowedFor(self.portal.doc1), True)
|
self.assertEquals(portal_discussion.isDiscussionAllowedFor(self.portal.doc1), True)
|
||||||
self.assertEquals(getattr(self.portal.doc1, 'allow_discussion', None), True)
|
self.assertEquals(getattr(self.portal.doc1, 'allow_discussion', None), True)
|
||||||
|
|
||||||
|
def test_comments_enabled_on_doc_in_subfolder(self):
|
||||||
|
typetool = self.portal.portal_types
|
||||||
|
typetool.constructContent('Folder', self.portal, 'folder1')
|
||||||
|
typetool.constructContent('Document', self.portal.folder1, 'doc2')
|
||||||
|
|
||||||
|
folder = self.portal.folder1
|
||||||
|
folder.allowDiscussion(False)
|
||||||
|
self.assertFalse(hasattr(aq_base(folder), 'allow_discussion'))
|
||||||
|
folder.allowDiscussion(True)
|
||||||
|
self.assertTrue(aq_base(folder).allow_discussion)
|
||||||
|
folder.allowDiscussion(False)
|
||||||
|
self.assertFalse(aq_base(folder).allow_discussion)
|
||||||
|
|
||||||
|
doc = self.portal.folder1.doc2
|
||||||
|
conversation = IConversation(doc)
|
||||||
|
self.assertEquals(conversation.enabled(), False)
|
||||||
|
|
||||||
|
# We have to allow discussion on Document content type, since
|
||||||
|
# otherwise allow_discussion will always return False
|
||||||
|
portal_types = getToolByName(self.portal, 'portal_types')
|
||||||
|
document_fti = getattr(portal_types, 'Document')
|
||||||
|
document_fti.manage_changeProperties(allow_discussion = True)
|
||||||
|
|
||||||
|
self.assertEquals(conversation.enabled(), True)
|
||||||
|
|
||||||
def test_disable_commenting_globally(self):
|
def test_disable_commenting_globally(self):
|
||||||
|
|
||||||
# Create a conversation.
|
# Create a conversation.
|
||||||
|
Loading…
Reference in New Issue
Block a user