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



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

def post_to_inboxes(activity)
  # Get the list of actors we need to send the activity to
  inboxes = inboxes_for(activity)
  Rails.logger.debug('Nobody to notice') && return if inboxes.none?

  # Deliver to each inbox
  message = payload(activity)
  inboxes.each do |url|
    Rails.logger.debug { "Sending activity ##{activity.id} to inbox at #{url}" }
    post_to_inbox(inbox_url: url, message: message, from: activity.actor)
  end
end