Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add notifications after Ploneboard comments

  • Loading branch information...
commit 78f33bf9daddab9bf637d6ced15af854cb697be7 1 parent 1d3e8dd
@amleczko amleczko authored
Showing with 24 additions and 0 deletions.
  1. +18 −0 src/restarter/policy/events.py
  2. +6 −0 src/restarter/policy/events.zcml
View
18 src/restarter/policy/events.py
@@ -494,3 +494,21 @@ def user_created(member, event):
# notify('notify/sms', params)
+def ploneboard_email_notification(comment, event):
+ emails = []
+ conversation = comment.getConversation()
+ for reply in conversation.objectValues():
+ email = reply.getOwner().getProperty('email', None)
+ if email:
+ emails.append(email)
+
+ member = comment.portal_membership.getAuthenticatedMember()
+ for email in set(emails):
+ if email:
+ params = {'email_message': NEW_COMMENT % (member.getProperty('fullname', 'User'),
+ html2text.html2text(comment.getText().decode('utf8', 'ignore')),
+ conversation.absolute_url()),
+ 'email_subject': NEW_COMMENT_SUBJECT,
+ 'email': email}
+ notify('notify', params)
+
View
6 src/restarter/policy/events.zcml
@@ -52,6 +52,12 @@
/>
<subscriber
+ for="Products.Ploneboard.interfaces.IComment
+ Products.Archetypes.interfaces.IObjectInitializedEvent"
+ handler=".events.ploneboard_email_notification"
+ />
+
+ <subscriber
for=".interfaces.ICompany
.interfaces.IDisqusNotify"
handler=".events.company_commented"
Please sign in to comment.
Something went wrong with that request. Please try again.