Skip to content

Commit

Permalink
💄 endless and ever appeasing of the coppers
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyf committed Apr 16, 2024
1 parent 5acc3bc commit baa4d60
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
27 changes: 16 additions & 11 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# rubocop:disable Metrics/ClassLength
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Expand All @@ -26,7 +27,7 @@ class ApplicationController < ActionController::Base
before_action :set_account_specific_connections!
before_action :elevate_single_tenant!, if: :singletenant?
skip_after_action :discard_flash_if_xhr

rescue_from Apartment::TenantNotFound do
raise ActionController::RoutingError, 'Not Found'
end
Expand All @@ -39,8 +40,8 @@ def hidden?

def api_or_pdf?
request.format.to_s.match('json') ||
params[:print] ||
request.path.include?('api') ||
params[:print] ||
request.path.include?('api') ||
request.path.include?('pdf')
end

Expand Down Expand Up @@ -82,14 +83,18 @@ def guest_user
return @guest_user if @guest_user
if session[:guest_user_id]
# Override - added #unscoped to include guest users who are filtered out of User queries by default
@guest_user = User.unscoped.find_by(User.authentication_keys.first => session[:guest_user_id]) rescue nil
@guest_user = nil if @guest_user.respond_to? :guest and !@guest_user.guest
@guest_user = begin
User.unscoped.find_by(User.authentication_keys.first => session[:guest_user_id])
rescue
nil
end
@guest_user = nil if @guest_user.respond_to?(:guest) && !@guest_user.guest
end
@guest_user ||= begin
u = create_guest_user(session[:guest_user_id])
session[:guest_user_id] = u.send(User.authentication_keys.first)
u
end
u = create_guest_user(session[:guest_user_id])
session[:guest_user_id] = u.send(User.authentication_keys.first)
u
end
@guest_user
end

Expand Down Expand Up @@ -161,6 +166,6 @@ def append_info_to_payload(payload)
super
payload[:request_id] = request.uuid
payload[:user_id] = current_user.id if current_user
payload[:account_id] = current_account.cname if current_account
end
payload[:account_id] = current_account.cname if current_account
end
# rubocop:enable Metrics/ClassLength
1 change: 0 additions & 1 deletion app/models/concerns/bulkrax/has_matchers_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def geonames_lookup(result)
end
end


# Prepending this to `Bulkrax::HasMatchers` yielded an unbound method
# Thus, I am prepending it to `Bulkrax::Entry` since that mixes in `Bulkrax::HasMatchers`
Bulkrax::Entry.prepend(Bulkrax::HasMatchersDecorator)

0 comments on commit baa4d60

Please sign in to comment.