Partially revert 4466fcf1bc
.
This commit is contained in:
parent
9b7cbe444c
commit
3c6a8a2bb1
|
@ -25,7 +25,6 @@ class Auth::DefaultCurrentUserProvider
|
||||||
# our current user, return nil if none is found
|
# our current user, return nil if none is found
|
||||||
def current_user
|
def current_user
|
||||||
return @env[CURRENT_USER_KEY] if @env.key?(CURRENT_USER_KEY)
|
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
|
# bypass if we have the shared session header
|
||||||
if shared_key = @env['HTTP_X_SHARED_SESSION_KEY']
|
if shared_key = @env['HTTP_X_SHARED_SESSION_KEY']
|
||||||
|
|
|
@ -192,28 +192,6 @@ describe Auth::DefaultCurrentUserProvider do
|
||||||
u.reload
|
u.reload
|
||||||
expect(u.last_seen_at).to eq(nil)
|
expect(u.last_seen_at).to eq(nil)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
it "should update ajax reqs with discourse visible" do
|
it "should update ajax reqs with discourse visible" do
|
||||||
|
|
Loading…
Reference in New Issue