Add ability to filter reports by target account domain (#12154)
* Add ability to filter reports by target account domain * Reword by_target_domain label
This commit is contained in:
parent
f3a93987b6
commit
d8f96028c5
|
@ -55,7 +55,8 @@ module Admin
|
||||||
params.permit(
|
params.permit(
|
||||||
:account_id,
|
:account_id,
|
||||||
:resolved,
|
:resolved,
|
||||||
:target_account_id
|
:target_account_id,
|
||||||
|
:by_target_domain
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Admin::FilterHelper
|
module Admin::FilterHelper
|
||||||
ACCOUNT_FILTERS = %i(local remote by_domain active pending silenced suspended username display_name email ip staff).freeze
|
ACCOUNT_FILTERS = %i(local remote by_domain active pending silenced suspended username display_name email ip staff).freeze
|
||||||
REPORT_FILTERS = %i(resolved account_id target_account_id).freeze
|
REPORT_FILTERS = %i(resolved account_id target_account_id by_target_domain).freeze
|
||||||
INVITE_FILTER = %i(available expired).freeze
|
INVITE_FILTER = %i(available expired).freeze
|
||||||
CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze
|
CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze
|
||||||
TAGS_FILTERS = %i(directory reviewed unreviewed pending_review popular active name).freeze
|
TAGS_FILTERS = %i(directory reviewed unreviewed pending_review popular active name).freeze
|
||||||
|
|
|
@ -19,6 +19,8 @@ class ReportFilter
|
||||||
|
|
||||||
def scope_for(key, value)
|
def scope_for(key, value)
|
||||||
case key.to_sym
|
case key.to_sym
|
||||||
|
when :by_target_domain
|
||||||
|
Report.where(target_account: Account.where(domain: value))
|
||||||
when :resolved
|
when :resolved
|
||||||
Report.resolved
|
Report.resolved
|
||||||
when :account_id
|
when :account_id
|
||||||
|
|
|
@ -8,6 +8,20 @@
|
||||||
%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'
|
||||||
|
|
||||||
|
= form_tag admin_reports_url, method: 'GET', class: 'simple_form' do
|
||||||
|
.fields-group
|
||||||
|
- Admin::FilterHelper::REPORT_FILTERS.each do |key|
|
||||||
|
- if params[key].present?
|
||||||
|
= hidden_field_tag key, params[key]
|
||||||
|
|
||||||
|
- %i(by_target_domain).each do |key|
|
||||||
|
.input.string.optional
|
||||||
|
= text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.reports.#{key}")
|
||||||
|
|
||||||
|
.actions
|
||||||
|
%button= t('admin.accounts.search')
|
||||||
|
= link_to t('admin.accounts.reset'), admin_reports_path, class: 'button negative'
|
||||||
|
|
||||||
- @reports.group_by(&:target_account_id).each do |target_account_id, reports|
|
- @reports.group_by(&:target_account_id).each do |target_account_id, reports|
|
||||||
- target_account = reports.first.target_account
|
- target_account = reports.first.target_account
|
||||||
.report-card
|
.report-card
|
||||||
|
|
|
@ -405,6 +405,7 @@ en:
|
||||||
are_you_sure: Are you sure?
|
are_you_sure: Are you sure?
|
||||||
assign_to_self: Assign to me
|
assign_to_self: Assign to me
|
||||||
assigned: Assigned moderator
|
assigned: Assigned moderator
|
||||||
|
by_target_domain: Domain of reported account
|
||||||
comment:
|
comment:
|
||||||
none: None
|
none: None
|
||||||
created_at: Reported
|
created_at: Reported
|
||||||
|
|
Loading…
Reference in New Issue