31 lines
757 B
Ruby
31 lines
757 B
Ruby
module Notifications
|
|
class Mentioned < Notification
|
|
def mail_job
|
|
Workers::Mail::Mentioned
|
|
end
|
|
|
|
def popup_translation_key
|
|
"notifications.mentioned"
|
|
end
|
|
|
|
def deleted_translation_key
|
|
"notifications.mentioned_deleted"
|
|
end
|
|
|
|
def linked_object
|
|
target.post
|
|
end
|
|
|
|
def self.notify(mentionable, recipient_user_ids)
|
|
actor = mentionable.author
|
|
|
|
mentionable.mentions.select {|mention| mention.person.local? }.each do |mention|
|
|
recipient = mention.person
|
|
|
|
next if recipient == actor || !(mentionable.public || recipient_user_ids.include?(recipient.owner_id))
|
|
|
|
create_notification(recipient.owner_id, mention, actor).email_the_user(mention, actor)
|
|
end
|
|
end
|
|
end
|
|
end
|