Don't notify yourself of self-assignments
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user