diff --git a/kallithea/model/notification.py b/kallithea/model/notification.py --- a/kallithea/model/notification.py +++ b/kallithea/model/notification.py @@ -126,12 +126,18 @@ class NotificationModel(object): email_html_body = EmailNotificationModel() \ .get_email_tmpl(type_, 'html', **html_kwargs) - # don't send email to person who created this comment - rec_objs = set(recipients_objs).difference(set([created_by_obj])) + # don't send email to the person who caused the notification, except for + # notifications about new pull requests where the author is explicitly + # added. + rec_mails = set(obj.email for obj in recipients_objs) + if type_ == NotificationModel.TYPE_PULL_REQUEST: + rec_mails.add(created_by_obj.email) + else: + rec_mails.discard(created_by_obj.email) - # send email with notification to all other participants - for rec in rec_objs: - tasks.send_email([rec.email], email_subject, email_txt_body, + # send email with notification to participants + for rec_mail in sorted(rec_mails): + tasks.send_email([rec_mail], email_subject, email_txt_body, email_html_body, headers, from_name=created_by_obj.full_name_or_username) diff --git a/kallithea/tests/models/test_dump_html_mails.ref.html b/kallithea/tests/models/test_dump_html_mails.ref.html --- a/kallithea/tests/models/test_dump_html_mails.ref.html +++ b/kallithea/tests/models/test_dump_html_mails.ref.html @@ -882,6 +882,197 @@ View User Profile: http://newbie.org

pull_request, is_mention=False

 From: u1 u1 
+To: u1@example.com
+Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2
+
+
+
http://pr.org/7
+
+Added as Reviewer of Pull Request #7 "The Title" by Requesting User (root)
+
+
+Pull request #7 "The Title" by u2 u3 (u2)
+from https://dev.org/repo branch devbranch
+to http://mainline.com/repo branch trunk
+
+
+Description:
+
+This PR is 'awesome' because it does 
+ - please approve indented!
+
+
+Changesets:
+
+Introduce one and two
+Make one plus two equal tree
+
+
+View Pull Request: http://pr.org/7
+
+
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ Added as Reviewer of Pull Request #7 "The Title" by Requesting User (root) +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Pull request + #7 "The Title" + by + u2 u3 (u2). +
+
+ from + https://dev.org/repo + branch + devbranch +
+ to + http://mainline.com/repo + branch + trunk +
+
+
+ Description: +
+
+ + + + + + + + + + + + +
+
This PR is 'awesome' because it does <stuff>
- please approve indented!
+
+
+
Changesets:
+
+ +
+
+ + + + + + + +
+ +
+ + View Pull Request + +
+
+
+
+
+
+
+ + +
+
+

pull_request, is_mention=False

+
+From: u1 u1 
 To: u2@example.com
 Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2
 
@@ -1073,6 +1264,197 @@ View Pull Request: http://pr.org/7

pull_request, is_mention=True

 From: u1 u1 
+To: u1@example.com
+Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2
+
+
+
http://pr.org/7
+
+Mention on Pull Request #7 "The Title" by Requesting User (root)
+
+
+Pull request #7 "The Title" by u2 u3 (u2)
+from https://dev.org/repo branch devbranch
+to http://mainline.com/repo branch trunk
+
+
+Description:
+
+This PR is 'awesome' because it does 
+ - please approve indented!
+
+
+Changesets:
+
+Introduce one and two
+Make one plus two equal tree
+
+
+View Pull Request: http://pr.org/7
+
+
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ Mention on Pull Request #7 "The Title" by Requesting User (root) +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Pull request + #7 "The Title" + by + u2 u3 (u2). +
+
+ from + https://dev.org/repo + branch + devbranch +
+ to + http://mainline.com/repo + branch + trunk +
+
+
+ Description: +
+
+ + + + + + + + + + + + +
+
This PR is 'awesome' because it does <stuff>
- please approve indented!
+
+
+
Changesets:
+
+ +
+
+ + + + + + + +
+ +
+ + View Pull Request + +
+
+
+
+
+
+
+ + +
+
+

pull_request, is_mention=True

+
+From: u1 u1 
 To: u2@example.com
 Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2