Added filter in account moderation to for spam

• Added:
- filter in account moderation to for spam
This commit is contained in:
mgabdev 2021-02-03 00:58:58 -05:00
parent 33f4bc4650
commit dd8531237d
4 changed files with 11 additions and 1 deletions

View File

@ -206,6 +206,7 @@ module Admin
:pending, :pending,
:silenced, :silenced,
:suspended, :suspended,
:spam,
:username, :username,
:display_name, :display_name,
:email, :email,

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
module Admin::FilterHelper module Admin::FilterHelper
ACCOUNT_FILTERS = %i(local remote by_domain active pending silenced suspended username display_name email ip note staff).freeze ACCOUNT_FILTERS = %i(local remote by_domain active pending silenced suspended username display_name email ip note staff spam).freeze
REPORT_FILTERS = %i(resolved account_id target_account_id).freeze REPORT_FILTERS = %i(resolved account_id target_account_id).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

View File

@ -58,6 +58,8 @@ class AccountFilter
Account.joins(:account_stat) Account.joins(:account_stat)
when "sign_up_date_gte" when "sign_up_date_gte"
Account.where("created_at >= ?", value) Account.where("created_at >= ?", value)
when "spam"
Account.where(is_flagged_as_spam: true)
else else
raise "Unknown filter: #{key}" raise "Unknown filter: #{key}"
end end

View File

@ -8,6 +8,13 @@
%li= filter_link_to t('admin.accounts.moderation.active'), silenced: nil, suspended: nil, pending: nil %li= filter_link_to t('admin.accounts.moderation.active'), silenced: nil, suspended: nil, pending: nil
%li= filter_link_to t('admin.accounts.moderation.silenced'), silenced: '1', suspended: nil, pending: nil %li= filter_link_to t('admin.accounts.moderation.silenced'), silenced: '1', suspended: nil, pending: nil
%li= filter_link_to t('admin.accounts.moderation.suspended'), suspended: '1', silenced: nil, pending: nil %li= filter_link_to t('admin.accounts.moderation.suspended'), suspended: '1', silenced: nil, pending: nil
.filter-subset
%strong Permissions
%ul
%li= filter_link_to "All", spam: nil
%li= filter_link_to "Spam", spam: '1'
.filter-subset .filter-subset
%strong= t('admin.accounts.role') %strong= t('admin.accounts.role')
%ul %ul