Notification moderator: email of commentator added. Link as is but request to log in for moderating comment added.

New moderator notification with email and link to commented page and request to login.
No links to approve and delete: due to CSRF direct links to modification of Plone objects result in request to confirm. So page with comments is presented to moderator.
If already logged in, moderator is on comment to moderate.
If not logged in, moderator is on login page with came_from.
This commit is contained in:
Katja Suess 2019-12-01 19:47:08 +01:00
parent 1e5951101f
commit 3d3c638565

View File

@ -58,12 +58,12 @@ MAIL_NOTIFICATION_MESSAGE = _(
MAIL_NOTIFICATION_MESSAGE_MODERATOR = _( MAIL_NOTIFICATION_MESSAGE_MODERATOR = _(
u'mail_notification_message_moderator', u'mail_notification_message_moderator',
default=u'A comment on "${title}" ' default=u'A comment on "${title}" '
u'has been posted here: ${link}\n\n' u'has been posted by ${commentator}\n'
u'---\n' u'here: ${link}\n\n'
u'${text}\n'
u'---\n\n' u'---\n\n'
u'Approve comment:\n${link_approve}\n\n' u'${text}\n\n'
u'Delete comment:\n${link_delete}\n', u'---\n\n'
u'Log in to moderate.\n\n',
) )
logger = logging.getLogger('plone.app.discussion') logger = logging.getLogger('plone.app.discussion')
@ -419,8 +419,6 @@ def notify_moderator(obj, event):
# Compose email # Compose email
subject = translate(_(u'A comment has been posted.'), context=obj.REQUEST) subject = translate(_(u'A comment has been posted.'), context=obj.REQUEST)
link_approve = obj.absolute_url() + '/@@moderate-publish-comment'
link_delete = obj.absolute_url() + '/@@moderate-delete-comment'
message = translate( message = translate(
Message( Message(
MAIL_NOTIFICATION_MESSAGE_MODERATOR, MAIL_NOTIFICATION_MESSAGE_MODERATOR,
@ -428,8 +426,14 @@ def notify_moderator(obj, event):
'title': safe_unicode(content_object.title), 'title': safe_unicode(content_object.title),
'link': content_object.absolute_url() + '/view#' + obj.id, 'link': content_object.absolute_url() + '/view#' + obj.id,
'text': obj.text, 'text': obj.text,
'link_approve': link_approve, 'commentator': obj.author_email or translate(
'link_delete': link_delete, Message(
_(
u'label_anonymous',
default=u'Anonymous',
),
),
)
}, },
), ),
context=obj.REQUEST, context=obj.REQUEST,