Also move "shareable hidden"-logic to AlsoCommented, because it is the only one that needs it. And write some specs for mentioned and started sharing notifications. Fixes #6294
31 lines
760 B
Ruby
31 lines
760 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, mention, actor).try(:email_the_user, mention, actor)
|
|
end
|
|
end
|
|
end
|
|
end
|