Class: Notifications::AlsoCommented

Inherits:
Notification show all
Includes:
Commented
Defined in:
app/models/notifications/also_commented.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Commented

#deleted_translation_key

Methods inherited from Notification

concatenate_or_create, create_notification, #email_the_user, for, #linked_object, #set_read_state

Methods included from Diaspora::Fields::Guid

included, #set_guid

Class Method Details

.notify(comment, _recipient_user_ids) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/notifications/also_commented.rb', line 15

def self.notify(comment, _recipient_user_ids)
  actor = comment.author
  commentable = comment.commentable
  recipient_ids = commentable.participants.local.where.not(id: [commentable.author_id, actor.id]).pluck(:owner_id)

  User.where(id: recipient_ids).find_each do |recipient|
    next if recipient.is_shareable_hidden?(commentable) || mention_notification_exists?(comment, recipient.person)

    concatenate_or_create(recipient, commentable, actor).try(:email_the_user, comment, actor)
  end
end

Instance Method Details

#mail_jobObject


7
8
9
# File 'app/models/notifications/also_commented.rb', line 7

def mail_job
  Workers::Mail::AlsoCommented
end

11
12
13
# File 'app/models/notifications/also_commented.rb', line 11

def popup_translation_key
  "notifications.also_commented"
end