Add optional OAuth application to reports (#30539)
This commit is contained in:
parent
fa54b61216
commit
aa88aca0ad
11 changed files with 47 additions and 3 deletions
|
@ -10,7 +10,7 @@ class Api::V1::ReportsController < Api::BaseController
|
|||
@report = ReportService.new.call(
|
||||
current_account,
|
||||
reported_account,
|
||||
report_params
|
||||
report_params.merge(application: doorkeeper_token.application)
|
||||
)
|
||||
|
||||
render json: @report, serializer: REST::ReportSerializer
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# category :integer default("other"), not null
|
||||
# action_taken_at :datetime
|
||||
# rule_ids :bigint(8) is an Array
|
||||
# application_id :bigint(8)
|
||||
#
|
||||
|
||||
class Report < ApplicationRecord
|
||||
|
@ -31,6 +32,7 @@ class Report < ApplicationRecord
|
|||
rate_limit by: :account, family: :reports
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :application, class_name: 'Doorkeeper::Application', optional: true
|
||||
|
||||
with_options class_name: 'Account' do
|
||||
belongs_to :target_account
|
||||
|
|
|
@ -10,6 +10,7 @@ class ReportService < BaseService
|
|||
@comment = options.delete(:comment).presence || ''
|
||||
@category = options[:rule_ids].present? ? 'violation' : (options.delete(:category).presence || 'other')
|
||||
@rule_ids = options.delete(:rule_ids).presence
|
||||
@application = options.delete(:application).presence
|
||||
@options = options
|
||||
|
||||
raise ActiveRecord::RecordNotFound if @target_account.unavailable?
|
||||
|
@ -35,7 +36,8 @@ class ReportService < BaseService
|
|||
uri: @options[:uri],
|
||||
forwarded: forward_to_origin?,
|
||||
category: @category,
|
||||
rule_ids: @rule_ids
|
||||
rule_ids: @rule_ids,
|
||||
application: @application
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
= admin_account_link_to report.account
|
||||
- else
|
||||
= report.account.domain
|
||||
- if report.application.present?
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.reported_with_application')
|
||||
.report-header__details__item__content
|
||||
= report.application.name
|
||||
.report-header__details__item
|
||||
.report-header__details__item__header
|
||||
%strong= t('admin.reports.status')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue