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

38 lines
953 B
Ruby

module Notifications
class MentionedInComment < Notification
include Notifications::Mentioned
def popup_translation_key
"notifications.mentioned_in_comment"
end
def deleted_translation_key
"notifications.mentioned_in_comment_deleted"
end
def self.filter_mentions(mentions, mentionable, _recipient_user_ids)
people = mentionable.people_allowed_to_be_mentioned
if people == :all
mentions
else
mentions.where(person_id: people)
end
end
def mail_job
if !recipient.user_preferences.exists?(email_type: "mentioned_in_comment")
Workers::Mail::MentionedInComment
elsif shareable.author.owner_id == recipient_id
Workers::Mail::CommentOnPost
elsif shareable.participants.local.where(owner_id: recipient_id)
Workers::Mail::AlsoCommented
end
end
private
def shareable
linked_object.parent
end
end
end