|
|
@ -8,13 +8,15 @@ class ReportService < BaseService
|
|
|
|
@target_account = target_account
|
|
|
|
@target_account = target_account
|
|
|
|
@status_ids = options.delete(:status_ids) || []
|
|
|
|
@status_ids = options.delete(:status_ids) || []
|
|
|
|
@comment = options.delete(:comment) || ''
|
|
|
|
@comment = options.delete(:comment) || ''
|
|
|
|
|
|
|
|
@category = options.delete(:category) || 'other'
|
|
|
|
|
|
|
|
@rule_ids = options.delete(:rule_ids)
|
|
|
|
@options = options
|
|
|
|
@options = options
|
|
|
|
|
|
|
|
|
|
|
|
raise ActiveRecord::RecordNotFound if @target_account.suspended?
|
|
|
|
raise ActiveRecord::RecordNotFound if @target_account.suspended?
|
|
|
|
|
|
|
|
|
|
|
|
create_report!
|
|
|
|
create_report!
|
|
|
|
notify_staff!
|
|
|
|
notify_staff!
|
|
|
|
forward_to_origin! if !@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
|
|
|
|
forward_to_origin! if forward?
|
|
|
|
|
|
|
|
|
|
|
|
@report
|
|
|
|
@report
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -27,7 +29,9 @@ class ReportService < BaseService
|
|
|
|
status_ids: @status_ids,
|
|
|
|
status_ids: @status_ids,
|
|
|
|
comment: @comment,
|
|
|
|
comment: @comment,
|
|
|
|
uri: @options[:uri],
|
|
|
|
uri: @options[:uri],
|
|
|
|
forwarded: ActiveModel::Type::Boolean.new.cast(@options[:forward])
|
|
|
|
forwarded: forward?,
|
|
|
|
|
|
|
|
category: @category,
|
|
|
|
|
|
|
|
rule_ids: @rule_ids
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -48,6 +52,10 @@ class ReportService < BaseService
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def forward?
|
|
|
|
|
|
|
|
!@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def payload
|
|
|
|
def payload
|
|
|
|
Oj.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account))
|
|
|
|
Oj.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account))
|
|
|
|
end
|
|
|
|
end
|
|
|
|