mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 07:32:02 +01:00
30 lines
609 B
Ruby
30 lines
609 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ForwardReportService < BaseService
|
|
include Payloadable
|
|
|
|
def call(report)
|
|
@report = report
|
|
|
|
forward_to_origin!
|
|
update_report!
|
|
end
|
|
|
|
private
|
|
|
|
def forward_to_origin!
|
|
ActivityPub::DeliveryWorker.perform_async(payload, some_local_account.id, @report.target_account.inbox_url)
|
|
end
|
|
|
|
def update_report!
|
|
@report.update(forwarded: true)
|
|
end
|
|
|
|
def payload
|
|
Oj.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account))
|
|
end
|
|
|
|
def some_local_account
|
|
@some_local_account ||= Account.representative
|
|
end
|
|
end
|