diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb index 9e8e5e756..30f54820b 100644 --- a/app/controllers/concerns/authentication.rb +++ b/app/controllers/concerns/authentication.rb @@ -7,7 +7,7 @@ module Authentication after_action :ensure_development_magic_link_not_leaked helper_method :authenticated? - etag { Current.session.id if authenticated? } + etag { Current.identity.id if authenticated? } include LoginHelper end diff --git a/app/controllers/identities_controller.rb b/app/controllers/identities_controller.rb index 88d112dd4..f685cd348 100644 --- a/app/controllers/identities_controller.rb +++ b/app/controllers/identities_controller.rb @@ -1,6 +1,6 @@ class IdentitiesController < ApplicationController disallow_account_scope - + def show @identity = Current.identity end diff --git a/app/models/current.rb b/app/models/current.rb index 34c79d7d9..786e5e89b 100644 --- a/app/models/current.rb +++ b/app/models/current.rb @@ -2,8 +2,6 @@ class Current < ActiveSupport::CurrentAttributes attribute :session, :user, :identity, :account attribute :http_method, :request_id, :user_agent, :ip_address, :referrer - delegate :identity, to: :session, allow_nil: true - def session=(value) super(value) diff --git a/app/views/identities/show.json.jbuilder b/app/views/identities/show.json.jbuilder index ce74cb74d..5f8a1cefb 100644 --- a/app/views/identities/show.json.jbuilder +++ b/app/views/identities/show.json.jbuilder @@ -2,5 +2,5 @@ json.accounts @identity.users do |user| json.partial! "identities/account", account: user.account json.user do json.partial! "users/user", user: user - end + end end diff --git a/test/controllers/api_test.rb b/test/controllers/api_test.rb index 3a4c55aae..aa409de08 100644 --- a/test/controllers/api_test.rb +++ b/test/controllers/api_test.rb @@ -73,9 +73,11 @@ class ApiTest < ActionDispatch::IntegrationTest test "get identity" do identity = identities(:david) - get identity_path(format: :json), env: @davids_bearer_token - assert_response :success # Fix 302 redirect - assert_equal identity.accounts.count, @response.parsed_body["accounts"].count + untenanted do + get identity_path(format: :json), env: @davids_bearer_token + assert_response :success + assert_equal identity.accounts.count, @response.parsed_body["accounts"].count + end end private