Add mentionees as watchers

This commit is contained in:
Jorge Manrubia
2025-04-23 12:38:06 +02:00
parent 8ebb3f2fa9
commit edcc9e3279
7 changed files with 43 additions and 4 deletions
+16 -2
View File
@@ -1,5 +1,6 @@
class Notifier::Event < Notifier
delegate :card, :creator, to: :source
delegate :watchers_and_subscribers, to: :card
private
def resource
@@ -15,9 +16,22 @@ class Notifier::Event < Notifier
when "assigned"
source.assignees.excluding(card.collection.access_only_users)
when "published"
card.watchers_and_subscribers(include_only_watching: true).without(creator)
watchers_and_subscribers(include_only_watching: true).without(creator, *mentionees)
when "commented"
watchers_and_subscribers.without(creator, *mentionees)
else
card.watchers_and_subscribers.without(creator)
watchers_and_subscribers.without(creator)
end
end
def mentionees
case source.action
when "published"
source.card.mentionees
when "commented"
source.comment.mentionees
else
[]
end
end
end