Check if the current user has configured an e-mail address for the email notification option. Refs #11428
svn path=/plone.app.discussion/trunk/; revision=47069
This commit is contained in:
parent
cb60df8c60
commit
0c435dc9ca
@ -4,6 +4,10 @@ Changelog
|
|||||||
2.0RC1 (unreleased)
|
2.0RC1 (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
- 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]
|
||||||
|
|
||||||
- Import Owned from OFS.owner to avoid deprecation warnings.
|
- Import Owned from OFS.owner to avoid deprecation warnings.
|
||||||
[timo]
|
[timo]
|
||||||
|
|
||||||
@ -18,6 +22,7 @@ Changelog
|
|||||||
Plone 4.1.
|
Plone 4.1.
|
||||||
[timo]
|
[timo]
|
||||||
|
|
||||||
|
|
||||||
1.0RC1 (unreleased)
|
1.0RC1 (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -106,10 +106,17 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
|
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings, check=False)
|
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():
|
# Hide the user_notification checkbox if user notification is disabled
|
||||||
self.widgets['user_notification'].mode = interfaces.HIDDEN_MODE
|
# 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):
|
def updateActions(self):
|
||||||
super(CommentForm, self).updateActions()
|
super(CommentForm, self).updateActions()
|
||||||
|
Loading…
Reference in New Issue
Block a user