add anonymous_email_enabled settings to really let integrator activate it. add the migration script which add the option to the registry and do not change the behavior: the email will not be displayed by default
This commit is contained in:
parent
84ba3661e0
commit
a16958c1c7
@ -105,13 +105,12 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
|||||||
self.widgets['author_name'].mode = interfaces.HIDDEN_MODE
|
self.widgets['author_name'].mode = interfaces.HIDDEN_MODE
|
||||||
self.widgets['author_email'].mode = interfaces.HIDDEN_MODE
|
self.widgets['author_email'].mode = interfaces.HIDDEN_MODE
|
||||||
|
|
||||||
# Todo: Since we are not using the author_email field in the
|
|
||||||
# current state, we hide it by default. But we keep the field for
|
|
||||||
# integrators or later use.
|
|
||||||
self.widgets['author_email'].mode = interfaces.HIDDEN_MODE
|
|
||||||
|
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings, check=False)
|
settings = registry.forInterface(IDiscussionSettings, check=False)
|
||||||
|
|
||||||
|
if mtool.isAnonymousUser() and not settings.anonymous_email_enabled:
|
||||||
|
self.widgets['author_email'].mode = interfaces.HIDDEN_MODE
|
||||||
|
|
||||||
member = mtool.getAuthenticatedMember()
|
member = mtool.getAuthenticatedMember()
|
||||||
member_email = member.getProperty('email')
|
member_email = member.getProperty('email')
|
||||||
|
|
||||||
|
@ -322,6 +322,15 @@ class IDiscussionSettings(Interface):
|
|||||||
required=False,
|
required=False,
|
||||||
default=False)
|
default=False)
|
||||||
|
|
||||||
|
anonymous_email_enabled = schema.Bool(
|
||||||
|
title=_(u"label_anonymous_email_enabled",
|
||||||
|
default=u"Enable anonymous email field"),
|
||||||
|
description=_(u"help_anonymous_email_enabled",
|
||||||
|
default=u"If selected, anonymous user will have to "
|
||||||
|
"give their email."),
|
||||||
|
required=False,
|
||||||
|
default=False)
|
||||||
|
|
||||||
|
|
||||||
class IDiscussionLayer(Interface):
|
class IDiscussionLayer(Interface):
|
||||||
"""Request marker installed via browserlayer.xml.
|
"""Request marker installed via browserlayer.xml.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<metadata>
|
<metadata>
|
||||||
<version>100</version>
|
<version>110</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>profile-plone.app.registry:default</dependency>
|
<dependency>profile-plone.app.registry:default</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -6,3 +6,10 @@ from plone.app.discussion.interfaces import IDiscussionSettings
|
|||||||
def update_registry(context):
|
def update_registry(context):
|
||||||
registry = getUtility(IRegistry)
|
registry = getUtility(IRegistry)
|
||||||
registry.registerInterface(IDiscussionSettings)
|
registry.registerInterface(IDiscussionSettings)
|
||||||
|
|
||||||
|
|
||||||
|
def add_anonymous_email_enabled_settings(context):
|
||||||
|
registry = getUtility(IRegistry)
|
||||||
|
key = 'plone.app.discussion.interfaces.IDiscussionSettings.'
|
||||||
|
key += 'anonymous_email_enabled'
|
||||||
|
registry[key] = False
|
||||||
|
@ -11,4 +11,12 @@
|
|||||||
handler=".upgrades.update_registry"
|
handler=".upgrades.update_registry"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<genericsetup:upgradeStep
|
||||||
|
source="*"
|
||||||
|
destination="110"
|
||||||
|
title="Update plone.app.discussion setting registry"
|
||||||
|
description=""
|
||||||
|
profile="plone.app.discussion:default"
|
||||||
|
handler=".upgrades.update_registry"
|
||||||
|
/>
|
||||||
</configure>
|
</configure>
|
||||||
|
Loading…
Reference in New Issue
Block a user