FIX: User enabled readonly mode was not working.

This commit is contained in:
Guo Xiang Tan 2016-08-25 23:30:41 +08:00
parent 40e0298db4
commit 2f39293867
2 changed files with 9 additions and 1 deletions

View File

@ -235,7 +235,7 @@ module Discourse
end
def self.readonly_mode?
recently_readonly? || !!$redis.get(READONLY_MODE_KEY)
recently_readonly? || !!$redis.get(READONLY_MODE_KEY) || !!$redis.get(USER_READONLY_MODE_KEY)
end
def self.request_refresh!

View File

@ -158,6 +158,14 @@ describe Discourse do
Discourse.received_readonly!
expect(Discourse.readonly_mode?).to eq(true)
end
it "returns true when user enabled readonly mode key is present in redis" do
Discourse.enable_readonly_mode(user_enabled: true)
expect(Discourse.readonly_mode?).to eq(true)
Discourse.disable_readonly_mode(user_enabled: true)
expect(Discourse.readonly_mode?).to eq(false)
end
end
describe ".received_readonly!" do