Check if the current user has configured an e-mail address for the email notification option. Refs #11428
svn path=/plone.app.discussion/branches/1.x/; revision=47068
This commit is contained in:
		
							parent
							
								
									65a4371d4d
								
							
						
					
					
						commit
						15c681d27f
					
				@ -1,6 +1,14 @@
 | 
			
		||||
Changelog
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
1.0 (2011-01-24)
 | 
			
		||||
----------------
 | 
			
		||||
 | 
			
		||||
- Check if the current user has configured an e-mail address for the email 
 | 
			
		||||
  notification option. This fixes http://dev.plone.org/plone/ticket/11428.
 | 
			
		||||
  [timo]  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1.0RC2 (2011-01-24)
 | 
			
		||||
-------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -106,10 +106,17 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
 | 
			
		||||
 | 
			
		||||
        registry = queryUtility(IRegistry)
 | 
			
		||||
        settings = registry.forInterface(IDiscussionSettings, check=False)
 | 
			
		||||
        portal_membership = getToolByName(self.context, 'portal_membership')
 | 
			
		||||
        mtool = getToolByName(self.context, 'portal_membership')
 | 
			
		||||
        member = mtool.getAuthenticatedMember()
 | 
			
		||||
        member_email = member.getProperty('email')
 | 
			
		||||
 | 
			
		||||
        if not settings.user_notification_enabled or portal_membership.isAnonymousUser():
 | 
			
		||||
            self.widgets['user_notification'].mode = interfaces.HIDDEN_MODE
 | 
			
		||||
        # Hide the user_notification checkbox if user notification is disabled 
 | 
			
		||||
        # or the user is not logged in. Also check if the user has a valid email
 | 
			
		||||
        # address
 | 
			
		||||
        if member_email == '' or \
 | 
			
		||||
           not settings.user_notification_enabled or \
 | 
			
		||||
           mtool.isAnonymousUser():
 | 
			
		||||
                self.widgets['user_notification'].mode = interfaces.HIDDEN_MODE
 | 
			
		||||
 | 
			
		||||
    def updateActions(self):
 | 
			
		||||
        super(CommentForm, self).updateActions()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user