Partially revert 4466fcf1bc.

This commit is contained in:
Guo Xiang Tan 2019-01-21 15:36:10 +08:00
parent 9b7cbe444c
commit 3c6a8a2bb1
2 changed files with 0 additions and 23 deletions

View File

@ -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']

View File

@ -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