diff --git a/app/models/notifier/card_event_notifier.rb b/app/models/notifier/card_event_notifier.rb index 899ee53fb..f36a1f12c 100644 --- a/app/models/notifier/card_event_notifier.rb +++ b/app/models/notifier/card_event_notifier.rb @@ -6,7 +6,7 @@ class Notifier::CardEventNotifier < Notifier def recipients case source.action when "card_assigned" - source.assignees.excluding(source.collection.access_only_users) + source.assignees.excluding(creator, *source.collection.access_only_users) when "card_published" watchers_and_subscribers(include_only_watching: true).without(creator, *card.mentionees) when "comment_created" diff --git a/test/models/notifier/event_notifier_test.rb b/test/models/notifier/event_notifier_test.rb index aafc2fcc1..2a99a2d39 100644 --- a/test/models/notifier/event_notifier_test.rb +++ b/test/models/notifier/event_notifier_test.rb @@ -56,6 +56,15 @@ class Notifier::EventNotifierTest < ActiveSupport::TestCase end test "assignment events do not notify users who are access-only for the collection" do + collections(:writebook).access_for(users(:jz)).watching! + events(:logo_assignment_jz).update! creator: users(:jz) + + notifications = Notifier.for(events(:logo_assignment_jz)).notify + + assert_empty notifications + end + + test "assignment events do not notify you if you assigned yourself" do collections(:writebook).access_for(users(:jz)).access_only! notifications = Notifier.for(events(:logo_assignment_jz)).notify