From 75543f8b8fe80038b98eb27f6e44fc5cda306446 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 18 Jun 2020 17:35:22 -0500 Subject: [PATCH] Move the nonprofits#show check for super_admin into a before_action --- app/controllers/nonprofits_controller.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/nonprofits_controller.rb b/app/controllers/nonprofits_controller.rb index c1ec0184..2bed1709 100755 --- a/app/controllers/nonprofits_controller.rb +++ b/app/controllers/nonprofits_controller.rb @@ -8,15 +8,11 @@ class NonprofitsController < ApplicationController helper_method :current_nonprofit_user? before_action :authenticate_nonprofit_user!, only: %i[dashboard dashboard_metrics dashboard_todos payment_history profile_todos recurring_donation_stats update verify_identity] - before_action :authenticate_super_admin!, only: [:destroy] + before_action :authenticate_super_admin!, if: proc {|c| ( c.action_name == "destroy") || (c.action_name == "show" && !current_nonprofit.published) } # get /nonprofits/:id # get /:state_code/:city/:name def show - if !current_nonprofit.published && !current_role?(:super_admin) - block_with_sign_in - return - end @nonprofit = current_nonprofit @url = Format::Url.concat(root_url, @nonprofit.url) @supporters = @nonprofit.supporters.not_deleted