Add category
and rule_ids
params to POST /api/v1/reports
(#17492)
This commit is contained in:
parent
5533fa28b6
commit
2f8159baad
4 changed files with 23 additions and 3 deletions
|
@ -8,13 +8,15 @@ class ReportService < BaseService
|
|||
@target_account = target_account
|
||||
@status_ids = options.delete(:status_ids) || []
|
||||
@comment = options.delete(:comment) || ''
|
||||
@category = options.delete(:category) || 'other'
|
||||
@rule_ids = options.delete(:rule_ids)
|
||||
@options = options
|
||||
|
||||
raise ActiveRecord::RecordNotFound if @target_account.suspended?
|
||||
|
||||
create_report!
|
||||
notify_staff!
|
||||
forward_to_origin! if !@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
|
||||
forward_to_origin! if forward?
|
||||
|
||||
@report
|
||||
end
|
||||
|
@ -27,7 +29,9 @@ class ReportService < BaseService
|
|||
status_ids: @status_ids,
|
||||
comment: @comment,
|
||||
uri: @options[:uri],
|
||||
forwarded: ActiveModel::Type::Boolean.new.cast(@options[:forward])
|
||||
forwarded: forward?,
|
||||
category: @category,
|
||||
rule_ids: @rule_ids
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -48,6 +52,10 @@ class ReportService < BaseService
|
|||
)
|
||||
end
|
||||
|
||||
def forward?
|
||||
!@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
|
||||
end
|
||||
|
||||
def payload
|
||||
Oj.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account))
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue