From 7e3cd265ddab366189b800a5502470ddb0704bd1 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 04 2016 11:26:18 +0000 Subject: Add/Remove people who explicitly asked to be/not be notified --- diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index b364e1b..262446d 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -145,6 +145,13 @@ def _get_emails_for_obj(obj): if unwatcher.user.default_email in emails: emails.remove(unwatcher.user.default_email) + # Add/Remove people who explicitly asked to be added/removed + for watcher in obj.watchers: + if not watcher.watch and watcher.user.default_email in emails: + emails.remove(watcher.user.default_email) + elif watcher.watch: + emails.add(watcher.user.default_email) + # Drop the email used by pagure when sending emails = _clean_emails( emails, pagure.APP.config.get(pagure.APP.config.get(