diaspora/app/models/notifications/mentioned.rb
2017-09-17 19:29:15 +02:00

26 lines
638 B
Ruby

# frozen_string_literal: true
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