diaspora/app/models/notifications/mentioned.rb
2016-11-28 15:56:56 +02:00

24 lines
607 B
Ruby

module Notifications
module Mentioned
extend ActiveSupport::Concern
def linked_object
target.mentions_container
end
module ClassMethods
def notify(mentionable, recipient_user_ids)
actor = mentionable.author
relevant_mentions = filter_mentions(
mentionable.mentions.local.where.not(person: actor),
mentionable,
recipient_user_ids
)
relevant_mentions.each do |mention|
create_notification(mention.person.owner, mention, actor).try(:email_the_user, mention, actor)
end
end
end
end
end