mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-19 07:57:00 +00:00
Add ability to filter reports by origin of target account (#16487)
This commit is contained in:
parent
ca8ac1a639
commit
7095c80373
|
@ -6,6 +6,7 @@ class ReportFilter
|
||||||
account_id
|
account_id
|
||||||
target_account_id
|
target_account_id
|
||||||
by_target_domain
|
by_target_domain
|
||||||
|
target_origin
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
attr_reader :params
|
attr_reader :params
|
||||||
|
@ -34,8 +35,21 @@ class ReportFilter
|
||||||
Report.where(account_id: value)
|
Report.where(account_id: value)
|
||||||
when :target_account_id
|
when :target_account_id
|
||||||
Report.where(target_account_id: value)
|
Report.where(target_account_id: value)
|
||||||
|
when :target_origin
|
||||||
|
target_origin_scope(value)
|
||||||
else
|
else
|
||||||
raise "Unknown filter: #{key}"
|
raise "Unknown filter: #{key}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def target_origin_scope(value)
|
||||||
|
case value.to_sym
|
||||||
|
when :local
|
||||||
|
Report.where(target_account: Account.local)
|
||||||
|
when :remote
|
||||||
|
Report.where(target_account: Account.remote)
|
||||||
|
else
|
||||||
|
raise "Unknown value: #{value}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
%ul
|
%ul
|
||||||
%li= filter_link_to t('admin.reports.unresolved'), resolved: nil
|
%li= filter_link_to t('admin.reports.unresolved'), resolved: nil
|
||||||
%li= filter_link_to t('admin.reports.resolved'), resolved: '1'
|
%li= filter_link_to t('admin.reports.resolved'), resolved: '1'
|
||||||
|
.filter-subset
|
||||||
|
%strong= t('admin.reports.target_origin')
|
||||||
|
%ul
|
||||||
|
%li= filter_link_to t('admin.accounts.location.all'), target_origin: nil
|
||||||
|
%li= filter_link_to t('admin.accounts.location.local'), target_origin: 'local'
|
||||||
|
%li= filter_link_to t('admin.accounts.location.remote'), target_origin: 'remote'
|
||||||
|
|
||||||
= form_tag admin_reports_url, method: 'GET', class: 'simple_form' do
|
= form_tag admin_reports_url, method: 'GET', class: 'simple_form' do
|
||||||
.fields-group
|
.fields-group
|
||||||
|
|
|
@ -579,6 +579,7 @@ en:
|
||||||
resolved: Resolved
|
resolved: Resolved
|
||||||
resolved_msg: Report successfully resolved!
|
resolved_msg: Report successfully resolved!
|
||||||
status: Status
|
status: Status
|
||||||
|
target_origin: Origin of reported account
|
||||||
title: Reports
|
title: Reports
|
||||||
unassign: Unassign
|
unassign: Unassign
|
||||||
unresolved: Unresolved
|
unresolved: Unresolved
|
||||||
|
|
Loading…
Reference in a new issue