diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb index 2355d50c5..582506902 100644 --- a/app/controllers/activitypub/inboxes_controller.rb +++ b/app/controllers/activitypub/inboxes_controller.rb @@ -76,7 +76,7 @@ class ActivityPub::InboxesController < ActivityPub::BaseController end def process_payload - event = ActivityLogEvent.new('inbound', request.path, Oj.load(body, mode: :strict)) + event = ActivityLogEvent.new('inbound', "https://#{Rails.configuration.x.web_domain}#{request.path}", Oj.load(body, mode: :strict)) @activity_log_publisher.publish(event) diff --git a/app/lib/activity_log_audience_helper.rb b/app/lib/activity_log_audience_helper.rb index f9a359310..5ab44351a 100644 --- a/app/lib/activity_log_audience_helper.rb +++ b/app/lib/activity_log_audience_helper.rb @@ -9,26 +9,24 @@ class ActivityLogAudienceHelper actor = activity_log_event.data['actor'] if actor and match = actor.match(Regexp.new("https://#{domain}/users/([^/]*)")) - return [match.captures[0]] + [match.captures[0]] else - return [] + [] end - end - - if activity_log_event.type == 'inbound' + elsif activity_log_event.type == 'inbound' if match = activity_log_event.path.match(Regexp.new("https://#{domain}/users/([^/]*)/inbox")) - return [match.captures[0]] + [match.captures[0]] elsif activity_log_event.path == "https://#{domain}/inbox" - return ['to', 'bto', 'cc', 'bcc'] + ['to', 'bto', 'cc', 'bcc'] .map { |target| actors(activity_log_event.data[target]) } .flatten .uniq + else + [] end - - return [] + else + [] end - - return [] end private diff --git a/lib/activity_log_subscriber.rb b/lib/activity_log_subscriber.rb index 288fdc246..f92c0f63b 100644 --- a/lib/activity_log_subscriber.rb +++ b/lib/activity_log_subscriber.rb @@ -10,7 +10,8 @@ class ActivityLogSubscriber json = Oj.load(message, mode: :strict) event = ActivityLogEvent.new(json['type'], json['path'], json['data']) - ActivityLogger.log('admin', event) + ActivityLogAudienceHelper.audience(event) + .each { |username| ActivityLogger.log(username, event) } end end end