diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 82a2429e..1a3d973e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,7 @@ require 'async/container' class ApplicationController < ActionController::Base protect_from_forgery - helper_method :current_user, :user_signed_in? + helper_method :current_user, :support_staff?, :user_signed_in? before_action :set_locale @@ -111,10 +111,12 @@ class ApplicationController < ActionController::Base return_to || root_path end + def support_staff? + current_user&.support_staff? + end + def support_staff_only - unless current_user&.support_staff? - raise AccessDenied, "Support staff only" - end + raise AccessDenied, "Support staff only" unless support_staff? end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 91f870c8..3e55c8ee 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -127,10 +127,6 @@ module ApplicationHelper !@hide_home_link end - def support_staff? - user_signed_in? && current_user.support_staff? - end - def impress_2020_meta_tags origin = Rails.configuration.impress_2020_origin support_secret = Rails.application.credentials.dig(