From 3c6a8a2bb1588d41670b5e6ffd58f2478c2cc622 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 21 Jan 2019 15:36:10 +0800 Subject: [PATCH] Partially revert 4466fcf1bc04bf6cb2eb493bd7b2d8b86eae109d. --- lib/auth/default_current_user_provider.rb | 1 - .../default_current_user_provider_spec.rb | 22 ------------------- 2 files changed, 23 deletions(-) diff --git a/lib/auth/default_current_user_provider.rb b/lib/auth/default_current_user_provider.rb index d5b59f04ddc..a01e70f3ae8 100644 --- a/lib/auth/default_current_user_provider.rb +++ b/lib/auth/default_current_user_provider.rb @@ -25,7 +25,6 @@ class Auth::DefaultCurrentUserProvider # our current user, return nil if none is found def current_user return @env[CURRENT_USER_KEY] if @env.key?(CURRENT_USER_KEY) - raise Discourse::ReadOnly if Discourse.pg_readonly_mode? # bypass if we have the shared session header if shared_key = @env['HTTP_X_SHARED_SESSION_KEY'] diff --git a/spec/components/auth/default_current_user_provider_spec.rb b/spec/components/auth/default_current_user_provider_spec.rb index 280b73922a0..4101a42d766 100644 --- a/spec/components/auth/default_current_user_provider_spec.rb +++ b/spec/components/auth/default_current_user_provider_spec.rb @@ -192,28 +192,6 @@ describe Auth::DefaultCurrentUserProvider do u.reload expect(u.last_seen_at).to eq(nil) end - - describe "when readonly mode is enabled due to postgres" do - let(:test_provider) { provider("/") } - let(:user) { Fabricate(:user) } - - before do - test_provider.log_on_user(user, {}, {}) - Discourse.enable_readonly_mode(Discourse::PG_READONLY_MODE_KEY) - end - - after do - Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY) - end - - it "should not update last seen at" do - expect(test_provider.current_user).to eq(user) - - expect do - provider("/?api_key=hello").current_user - end.to raise_error(Discourse::ReadOnly) - end - end end it "should update ajax reqs with discourse visible" do