changeset 2387:7d517a35b6c9 beta

Don't send emails to person who comment on changeset
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 04 Jun 2012 22:03:40 +0200
parents ed8c2fc8dd3b
children a0ef98f2520b e5f4085f72f1
files rhodecode/model/comment.py rhodecode/model/notification.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/comment.py	Mon Jun 04 21:37:41 2012 +0200
+++ b/rhodecode/model/comment.py	Mon Jun 04 22:03:40 2012 +0200
@@ -102,6 +102,7 @@
             # add changeset author if it's in rhodecode system
             recipients += [User.get_by_email(author_email)]
 
+            # create notification objects, and emails
             NotificationModel().create(
               created_by=user_id, subject=subj, body=body,
               recipients=recipients, type_=Notification.TYPE_CHANGESET_COMMENT
--- a/rhodecode/model/notification.py	Mon Jun 04 21:37:41 2012 +0200
+++ b/rhodecode/model/notification.py	Mon Jun 04 22:03:40 2012 +0200
@@ -103,8 +103,11 @@
         if with_email is False:
             return notif
 
-        # send email with notification
-        for rec in recipients_objs:
+        #don't send email to person who created this comment
+        rec_objs = set(recipients_objs).difference(set([created_by_obj]))
+
+        # send email with notification to all other participants
+        for rec in rec_objs:
             email_subject = NotificationModel().make_description(notif, False)
             type_ = type_
             email_body = body