diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index 908cbe65..31359ee8 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -215,6 +215,10 @@ module Admin :note, :status_count_gte, :sign_up_date_gte, + :is_pro, + :is_investor, + :is_verified, + :is_donor, ) end diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index fdf2f4e6..9987ade1 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 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 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 b4b813b6..55f20ac5 100644 --- a/app/models/account_filter.rb +++ b/app/models/account_filter.rb @@ -60,6 +60,14 @@ class AccountFilter Account.where("created_at >= ?", value) when "spam" 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 raise "Unknown filter: #{key}" end diff --git a/app/views/admin/accounts/_account.html.haml b/app/views/admin/accounts/_account.html.haml index 9b195ea3..63bcdbda 100644 --- a/app/views/admin/accounts/_account.html.haml +++ b/app/views/admin/accounts/_account.html.haml @@ -1,17 +1,22 @@ %tr %td = 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 - 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 - else \- %td - %samp= number_with_delimiter account.statuses.count \ No newline at end of file + %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 \ No newline at end of file diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml index f2eb1bdc..a55838fd 100644 --- a/app/views/admin/accounts/index.html.haml +++ b/app/views/admin/accounts/index.html.haml @@ -10,10 +10,14 @@ %li= filter_link_to t('admin.accounts.moderation.suspended'), suspended: '1', silenced: nil, pending: nil .filter-subset - %strong Permissions + %strong Flags %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 "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 %strong= t('admin.accounts.role') @@ -47,9 +51,9 @@ %thead %tr %th= t('admin.accounts.username') - %th= t('admin.accounts.most_recent_ip') %th= t('admin.accounts.most_recent_activity') %th Status count + %th Flags %th %tbody = render @accounts