Respect the allow_comments field on an object and avoid calculations if no comments should be shown.
svn path=/plone.app.discussion/trunk/; revision=33511
This commit is contained in:
		
							parent
							
								
									034d0a93ad
								
							
						
					
					
						commit
						9f4129a65f
					
				@ -4,6 +4,7 @@ Changelog
 | 
				
			|||||||
1.0b3 (XXXX-XX-XX)
 | 
					1.0b3 (XXXX-XX-XX)
 | 
				
			||||||
------------------
 | 
					------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Respect the allow_comments field on an object and avoid calculations if no comments should be shown. [hannosch]
 | 
				
			||||||
* Automatically load the ZCML files of the captcha widgets if they are installed. [hannosch]
 | 
					* Automatically load the ZCML files of the captcha widgets if they are installed. [hannosch]
 | 
				
			||||||
* Fixed i18n domain in GenericSetup profiles to be ``plone``. Other values aren't supported for GS profiles. [hannosch]
 | 
					* Fixed i18n domain in GenericSetup profiles to be ``plone``. Other values aren't supported for GS profiles. [hannosch]
 | 
				
			||||||
* Provide our own copy of the default one state workflow. Not all Plone sites have this workflow installed. [hannosch]
 | 
					* Provide our own copy of the default one state workflow. Not all Plone sites have this workflow installed. [hannosch]
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,7 @@
 | 
				
			|||||||
 | 
					<tal:block tal:define="isDiscussionAllowed view/is_discussion_allowed"
 | 
				
			||||||
 | 
					           tal:condition="isDiscussionAllowed"
 | 
				
			||||||
 | 
					           i18n:domain="plone">
 | 
				
			||||||
<tal:block define="userHasReplyPermission view/can_reply;
 | 
					<tal:block define="userHasReplyPermission view/can_reply;
 | 
				
			||||||
                   isDiscussionAllowed view/is_discussion_allowed;
 | 
					 | 
				
			||||||
                   isAnonymousDiscussionAllowed view/anonymous_discussion_allowed;
 | 
					                   isAnonymousDiscussionAllowed view/anonymous_discussion_allowed;
 | 
				
			||||||
                   isAnon view/is_anonymous;
 | 
					                   isAnon view/is_anonymous;
 | 
				
			||||||
                   canManage view/can_manage;
 | 
					                   canManage view/can_manage;
 | 
				
			||||||
@ -7,9 +9,7 @@
 | 
				
			|||||||
                   has_replies python:view.has_replies(canManage);
 | 
					                   has_replies python:view.has_replies(canManage);
 | 
				
			||||||
                   showCommenterImage view/show_commenter_image;
 | 
					                   showCommenterImage view/show_commenter_image;
 | 
				
			||||||
                   errors options/state/getErrors|nothing;
 | 
					                   errors options/state/getErrors|nothing;
 | 
				
			||||||
                   wtool context/@@plone_tools/workflow"
 | 
					                   wtool context/@@plone_tools/workflow;">
 | 
				
			||||||
           tal:condition="isDiscussionAllowed"
 | 
					 | 
				
			||||||
           i18n:domain="plone">
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div class="reply"
 | 
					    <div class="reply"
 | 
				
			||||||
         tal:condition="python:isAnon and not isAnonymousDiscussionAllowed">
 | 
					         tal:condition="python:isAnon and not isAnonymousDiscussionAllowed">
 | 
				
			||||||
@ -154,4 +154,5 @@
 | 
				
			|||||||
        </fieldset>
 | 
					        </fieldset>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</tal:block>
 | 
				
			||||||
</tal:block>
 | 
					</tal:block>
 | 
				
			||||||
@ -125,13 +125,19 @@ class Conversation(Traversable, Persistent, Explicit):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        obj = aq_parent(self)
 | 
					        obj = aq_parent(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # If discussion is disabled for the object, bail out
 | 
				
			||||||
 | 
					        allow_discussion_flag = getattr(obj, 'allow_discussion', None)
 | 
				
			||||||
 | 
					        if allow_discussion_flag is False:
 | 
				
			||||||
 | 
					            return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Check if traversal returned a folder with discussion_allowed set
 | 
					        # Check if traversal returned a folder with discussion_allowed set
 | 
				
			||||||
        # to True or False.
 | 
					        # to True or False.
 | 
				
			||||||
        folder_allow_discussion = traverse_parents(obj)
 | 
					        folder_allow_discussion = traverse_parents(obj)
 | 
				
			||||||
        if folder_allow_discussion == True:
 | 
					
 | 
				
			||||||
 | 
					        if folder_allow_discussion is True:
 | 
				
			||||||
            if not getattr(self, 'allow_discussion', None):
 | 
					            if not getattr(self, 'allow_discussion', None):
 | 
				
			||||||
                return True
 | 
					                return True
 | 
				
			||||||
        elif folder_allow_discussion == False:
 | 
					        elif folder_allow_discussion is False:
 | 
				
			||||||
            if getattr(aq_inner(self.__parent__), 'allow_discussion', None):
 | 
					            if getattr(aq_inner(self.__parent__), 'allow_discussion', None):
 | 
				
			||||||
                return True
 | 
					                return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user