mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 15:03:44 +08:00
FIX: User enabled readonly mode was not working.
This commit is contained in:
parent
2c86c202e5
commit
2bce183581
|
@ -235,7 +235,7 @@ module Discourse
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.readonly_mode?
|
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
|
end
|
||||||
|
|
||||||
def self.request_refresh!
|
def self.request_refresh!
|
||||||
|
|
|
@ -158,6 +158,14 @@ describe Discourse do
|
||||||
Discourse.received_readonly!
|
Discourse.received_readonly!
|
||||||
expect(Discourse.readonly_mode?).to eq(true)
|
expect(Discourse.readonly_mode?).to eq(true)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe ".received_readonly!" do
|
describe ".received_readonly!" do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user