Permalink
Browse files

add notifications after Ploneboard comments

  • Loading branch information...
amleczko committed Jul 18, 2012
1 parent 1d3e8dd commit 78f33bf9daddab9bf637d6ced15af854cb697be7
Showing with 24 additions and 0 deletions.
  1. +18 −0 src/restarter/policy/events.py
  2. +6 −0 src/restarter/policy/events.zcml
@@ -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)
+
@@ -51,6 +51,12 @@
handler=".events.company_added"
/>
+ <subscriber
+ for="Products.Ploneboard.interfaces.IComment
+ Products.Archetypes.interfaces.IObjectInitializedEvent"
+ handler=".events.ploneboard_email_notification"
+ />
+
<subscriber
for=".interfaces.ICompany
.interfaces.IDisqusNotify"

0 comments on commit 78f33bf

Please sign in to comment.