From dd8531237d945b1517a1b6138953ccf878c2db7c Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 3 Feb 2021 00:58:58 -0500 Subject: [PATCH] Added filter in account moderation to for spam MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added: - filter in account moderation to for spam --- app/controllers/admin/accounts_controller.rb | 1 + app/helpers/admin/filter_helper.rb | 2 +- app/models/account_filter.rb | 2 ++ app/views/admin/accounts/index.html.haml | 7 +++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index 9abc2125..908cbe65 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -206,6 +206,7 @@ module Admin :pending, :silenced, :suspended, + :spam, :username, :display_name, :email, diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index 214c6536..fdf2f4e6 100644 --- a/app/helpers/admin/filter_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true 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 INVITE_FILTER = %i(available expired).freeze CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze diff --git a/app/models/account_filter.rb b/app/models/account_filter.rb index 2c3778da..b4b813b6 100644 --- a/app/models/account_filter.rb +++ b/app/models/account_filter.rb @@ -58,6 +58,8 @@ class AccountFilter Account.joins(:account_stat) when "sign_up_date_gte" Account.where("created_at >= ?", value) + when "spam" + Account.where(is_flagged_as_spam: true) else raise "Unknown filter: #{key}" end diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml index 1c80d3de..f2eb1bdc 100644 --- a/app/views/admin/accounts/index.html.haml +++ b/app/views/admin/accounts/index.html.haml @@ -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.silenced'), silenced: '1', suspended: 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 %strong= t('admin.accounts.role') %ul