Added new flags to admin dashboard account search

• Added:
- new flags to admin dashboard account search for PRO, investor, donor, verified
- moved spam to the flags column instead of next to username

• Removed:
- IP Address in account list

• Updated:
- Title for flags in account moderation header
This commit is contained in:
Developer 2021-02-10 12:24:09 -05:00
parent 65d8c7ee86
commit 30c05a6e96
5 changed files with 33 additions and 12 deletions

View File

@ -215,6 +215,10 @@ module Admin
:note, :note,
:status_count_gte, :status_count_gte,
:sign_up_date_gte, :sign_up_date_gte,
:is_pro,
:is_investor,
:is_verified,
:is_donor,
) )
end end

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 spam).freeze ACCOUNT_FILTERS = %i(local remote by_domain active pending silenced suspended username display_name email ip note staff spam is_pro is_investor is_donor is_verified).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

@ -60,6 +60,14 @@ class AccountFilter
Account.where("created_at >= ?", value) Account.where("created_at >= ?", value)
when "spam" when "spam"
Account.where(is_flagged_as_spam: true) Account.where(is_flagged_as_spam: true)
when "is_pro"
Account.where(is_pro: true)
when "is_investor"
Account.where(is_investor: true)
when "is_donor"
Account.where(is_donor: true)
when "is_verified"
Account.where(is_verified: true)
else else
raise "Unknown filter: #{key}" raise "Unknown filter: #{key}"
end end

View File

@ -1,13 +1,6 @@
%tr %tr
%td %td
= admin_account_link_to(account) = admin_account_link_to(account)
- if account.is_flagged_as_spam
%span{ :style => "display:block;margin:5px 0 0 20px;font-size:12px;background-color:#781600;border-radius:6px;color:#fff;width:40px;line-height:22px;font-weight:600;padding:2px 0 0 6px;" } SPAM
%td
- if account.user_current_sign_in_ip
%samp.ellipsized-ip{ title: account.user_current_sign_in_ip }= account.user_current_sign_in_ip
- else
\-
%td %td
- if account.user_current_sign_in_at - if account.user_current_sign_in_at
%time.time-ago{ datetime: account.user_current_sign_in_at.iso8601, title: l(account.user_current_sign_in_at) }= l account.user_current_sign_in_at %time.time-ago{ datetime: account.user_current_sign_in_at.iso8601, title: l(account.user_current_sign_in_at) }= l account.user_current_sign_in_at
@ -15,3 +8,15 @@
\- \-
%td %td
%samp= number_with_delimiter account.statuses.count %samp= number_with_delimiter account.statuses.count
%td
%div{ :style => "display:flex;flex-direction:row;" }
- if account.is_flagged_as_spam
%span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#781600;border-radius:6px;color:#fff;width:40px;line-height:22px;font-weight:600;padding:2px 0 0 6px;" } SPAM
- if account.is_pro
%span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#FFD700;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } P
- if account.is_verified
%span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#fff;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } V
- if account.is_donor
%span{ :style => "display:inline-block;margin-right:4px;font-size:12px;background-color:#4EA6FF;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } D
- if account.is_investor
%span{ :style => "display:inline-block;font-size:12px;background-color:#6DD900;border-radius:6px;color:#292929;width:24px;line-height:22px;font-weight:600;text-align:center;padding:2px 0 0 2px;" } I

View File

@ -10,10 +10,14 @@
%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 .filter-subset
%strong Permissions %strong Flags
%ul %ul
%li= filter_link_to "All", spam: nil %li= filter_link_to "All", spam: nil, is_pro: nil, is_donor: nil, is_investor: nil, is_verified: nil
%li= filter_link_to "Spam", spam: '1' %li= filter_link_to "Spam", spam: '1'
%li= filter_link_to "PRO", is_pro: '1'
%li= filter_link_to "Donor", is_donor: '1'
%li= filter_link_to "Investor", is_investor: '1'
%li= filter_link_to "Verified", is_verified: '1'
.filter-subset .filter-subset
%strong= t('admin.accounts.role') %strong= t('admin.accounts.role')
@ -47,9 +51,9 @@
%thead %thead
%tr %tr
%th= t('admin.accounts.username') %th= t('admin.accounts.username')
%th= t('admin.accounts.most_recent_ip')
%th= t('admin.accounts.most_recent_activity') %th= t('admin.accounts.most_recent_activity')
%th Status count %th Status count
%th Flags
%th %th
%tbody %tbody
= render @accounts = render @accounts