From 3cb15f0e3e4f2abecd4b8cf897c01c366e637a5d Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 2 Nov 2015 11:58:46 +0100 Subject: [PATCH] Fixing get_users_to_notify --- taiga/projects/notifications/services.py | 4 ++-- tests/integration/test_notifications.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/taiga/projects/notifications/services.py b/taiga/projects/notifications/services.py index 2be1c8fc..5a850d46 100644 --- a/taiga/projects/notifications/services.py +++ b/taiga/projects/notifications/services.py @@ -151,7 +151,7 @@ def get_users_to_notify(obj, *, discard_users=None) -> list: def _check_level(project:object, user:object, levels:tuple) -> bool: policy = get_notify_policy(project, user) - return policy.notify_level in [int(x) for x in levels] + return policy.notify_level in levels _can_notify_hard = partial(_check_level, project, levels=[NotifyLevel.all]) @@ -160,8 +160,8 @@ def get_users_to_notify(obj, *, discard_users=None) -> list: candidates = set() candidates.update(filter(_can_notify_hard, project.members.all())) + candidates.update(filter(_can_notify_hard, obj.project.get_watchers())) candidates.update(filter(_can_notify_light, obj.get_watchers())) - candidates.update(filter(_can_notify_light, obj.project.get_watchers())) candidates.update(filter(_can_notify_light, obj.get_participants())) # Remove the changer from candidates diff --git a/tests/integration/test_notifications.py b/tests/integration/test_notifications.py index 3173874f..3e04277c 100644 --- a/tests/integration/test_notifications.py +++ b/tests/integration/test_notifications.py @@ -352,7 +352,7 @@ def test_watching_users_to_notify_on_issue_modification_6(): watching_user_policy.notify_level = NotifyLevel.involved watching_user_policy.save() users = services.get_users_to_notify(issue) - assert users == {watching_user, issue.owner} + assert users == {issue.owner} def test_send_notifications_using_services_method_for_user_stories(settings, mail):