From 33f4bc465066ed8a0805e0287424a17e139e62fd Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Tue, 2 Feb 2021 21:11:48 -0500 Subject: [PATCH] Added button to reset a spam bool on an account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added: - button to reset a spam bool on an account in admin dashboard --- app/controllers/admin/accounts_controller.rb | 7 ++++++- app/views/admin/accounts/show.html.haml | 3 +++ config/routes.rb | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index c5b02120..9abc2125 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -2,7 +2,7 @@ module Admin 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_local_account!, only: [:enable, :memorialize, :approve, :reject] @@ -173,6 +173,11 @@ module Admin end end + def reset_spam + @account.is_flagged_as_spam = false + @account.save! + redirect_to admin_account_path(@account.id) + end private diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index f589922b..d0e2b7d5 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -142,6 +142,9 @@ %span YES - else %span no + - if @account.is_flagged_as_spam? + %td= table_link_to 'ban', 'Reset', reset_spam_admin_account_path(@account.id), method: :post + %tr %th= t('admin.accounts.most_recent_ip') diff --git a/config/routes.rb b/config/routes.rb index e254b270..b986899f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -140,6 +140,7 @@ Rails.application.routes.draw do post :remove_donor_badge post :add_investor_badge post :remove_investor_badge + post :reset_spam get :edit_pro put :save_pro end