Class: Fediverse::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/fediverse/notifier.rb

Class Method Summary collapse

Class Method Details

.post_to_inboxes(activity) ⇒ Object

Posts an activity to its recipients

Parameters:



9
10
11
12
13
14
15
16
17
18
# File 'lib/fediverse/notifier.rb', line 9

def post_to_inboxes(activity)
  actors = activity.recipients
  Rails.logger.debug('Nobody to notice') && return if actors.count.zero?

  message = payload(activity)
  actors.each do |recipient|
    Rails.logger.debug { "Sending activity ##{activity.id} to #{recipient.inbox_url}" }
    post_to_inbox(to: recipient, message: message, from: activity.actor)
  end
end