From 47a5319f45f06da9fa4bd5456835d6f30c339b1a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 24 2019 10:50:20 +0000 Subject: Always notify the person who opened the ticket/PR or are assigned to it Fixes https://pagure.io/pagure/issue/2324 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 079e719..77f7c64 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -292,15 +292,6 @@ def _get_emails_for_obj(obj): if comment.user.default_email: emails.add(comment.user.default_email) - # Add the person that opened the issue/PR - if obj.user.default_email: - emails.add(obj.user.default_email) - - # Add the person assigned to the issue/PR - if obj.isa in ["issue", "pull-request"]: - if obj.assignee and obj.assignee.default_email: - emails.add(obj.assignee.default_email) - # Add public notifications to lists/users set project-wide if obj.isa == "issue" and not obj.private: for notifs in obj.project.notifications.get("issues", []): @@ -337,6 +328,15 @@ def _get_emails_for_obj(obj): ), ) + # Add the person that opened the issue/PR + if obj.user.default_email: + emails.add(obj.user.default_email) + + # Add the person assigned to the issue/PR + if obj.isa in ["issue", "pull-request"]: + if obj.assignee and obj.assignee.default_email: + emails.add(obj.assignee.default_email) + return emails