Browse Source

only load session fiters when getting or exporting the logs (#1301)

pull/1305/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
8879748f82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/controllers/lettings_logs_controller.rb
  2. 4
      app/controllers/organisations_controller.rb
  3. 4
      app/controllers/sales_logs_controller.rb

4
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]

4
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?

4
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) }

Loading…
Cancel
Save