From 8879748f823b0017d2646f27603dd03706954a60 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 14 Feb 2023 15:39:49 +0000 Subject: [PATCH] only load session fiters when getting or exporting the logs (#1301) --- app/controllers/lettings_logs_controller.rb | 4 ++-- app/controllers/organisations_controller.rb | 4 ++-- app/controllers/sales_logs_controller.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/lettings_logs_controller.rb b/app/controllers/lettings_logs_controller.rb index 5181d21ca..f86a55a27 100644 --- a/app/controllers/lettings_logs_controller.rb +++ b/app/controllers/lettings_logs_controller.rb @@ -1,7 +1,7 @@ class LettingsLogsController < LogsController before_action :find_resource, except: %i[create index edit] - before_action :session_filters, if: :current_user - before_action :set_session_filters, if: :current_user + before_action :session_filters, if: :current_user, only: %i[index email_csv download_csv] + before_action :set_session_filters, if: :current_user, only: %i[index email_csv download_csv] before_action :extract_bulk_upload_from_session_filters, only: [:index] before_action :redirect_if_bulk_upload_resolved, only: [:index] diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 0c8c4a172..211283ffe 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -6,8 +6,8 @@ class OrganisationsController < ApplicationController before_action :authenticate_user! before_action :find_resource, except: %i[index new create] before_action :authenticate_scope!, except: [:index] - before_action -> { session_filters(specific_org: true) }, if: -> { current_user.support? || current_user.organisation.has_managing_agents? } - before_action :set_session_filters, if: -> { current_user.support? || current_user.organisation.has_managing_agents? } + before_action -> { session_filters(specific_org: true) }, if: -> { current_user.support? || current_user.organisation.has_managing_agents? }, only: %i[lettings_logs sales_logs email_csv download_csv] + before_action :set_session_filters, if: -> { current_user.support? || current_user.organisation.has_managing_agents? }, only: %i[lettings_logs sales_logs email_csv download_csv] def index redirect_to organisation_path(current_user.organisation) unless current_user.support? diff --git a/app/controllers/sales_logs_controller.rb b/app/controllers/sales_logs_controller.rb index 8a6c9937f..ecfeabcad 100644 --- a/app/controllers/sales_logs_controller.rb +++ b/app/controllers/sales_logs_controller.rb @@ -1,6 +1,6 @@ class SalesLogsController < LogsController - before_action :session_filters, if: :current_user - before_action :set_session_filters, if: :current_user + before_action :session_filters, if: :current_user, only: %i[index email_csv download_csv] + before_action :set_session_filters, if: :current_user, only: %i[index email_csv download_csv] def create super { SalesLog.new(log_params) }