Added button to reset a spam bool on an account

• Added:
- button to reset a spam bool on an account in admin dashboard
This commit is contained in:
mgabdev 2021-02-02 21:11:48 -05:00
parent e047a50967
commit 33f4bc4650
3 changed files with 10 additions and 1 deletions

View File

@ -2,7 +2,7 @@
module Admin module Admin
class AccountsController < BaseController class AccountsController < BaseController
before_action :set_account, only: [:show, :redownload, :remove_avatar, :remove_header, :enable, :unsilence, :unsuspend, :memorialize, :approve, :reject, :verify, :unverify, :add_donor_badge, :remove_donor_badge, :add_investor_badge, :remove_investor_badge, :edit_pro, :save_pro, :edit, :update] before_action :set_account, only: [:show, :redownload, :remove_avatar, :remove_header, :enable, :unsilence, :unsuspend, :memorialize, :approve, :reject, :verify, :unverify, :add_donor_badge, :remove_donor_badge, :add_investor_badge, :remove_investor_badge, :edit_pro, :save_pro, :edit, :update, :reset_spam]
before_action :require_remote_account!, only: [:redownload] before_action :require_remote_account!, only: [:redownload]
before_action :require_local_account!, only: [:enable, :memorialize, :approve, :reject] before_action :require_local_account!, only: [:enable, :memorialize, :approve, :reject]
@ -173,6 +173,11 @@ module Admin
end end
end end
def reset_spam
@account.is_flagged_as_spam = false
@account.save!
redirect_to admin_account_path(@account.id)
end
private private

View File

@ -142,6 +142,9 @@
%span YES %span YES
- else - else
%span no %span no
- if @account.is_flagged_as_spam?
%td= table_link_to 'ban', 'Reset', reset_spam_admin_account_path(@account.id), method: :post
%tr %tr
%th= t('admin.accounts.most_recent_ip') %th= t('admin.accounts.most_recent_ip')

View File

@ -140,6 +140,7 @@ Rails.application.routes.draw do
post :remove_donor_badge post :remove_donor_badge
post :add_investor_badge post :add_investor_badge
post :remove_investor_badge post :remove_investor_badge
post :reset_spam
get :edit_pro get :edit_pro
put :save_pro put :save_pro
end end