mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 18:41:07 +08:00
DEV: New readonly mode. Only applies to non-staff (#16243)
This commit is contained in:

committed by
GitHub

parent
985afe1092
commit
6e53f4d913
@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
|
||||
include JsonError
|
||||
include GlobalPath
|
||||
include Hijack
|
||||
include ReadOnlyHeader
|
||||
include ReadOnlyMixin
|
||||
include VaryHeader
|
||||
|
||||
attr_reader :theme_id
|
||||
@ -631,6 +631,7 @@ class ApplicationController < ActionController::Base
|
||||
store_preloaded("banner", banner_json)
|
||||
store_preloaded("customEmoji", custom_emoji)
|
||||
store_preloaded("isReadOnly", @readonly_mode.to_s)
|
||||
store_preloaded("isStaffWritesOnly", @staff_writes_only_mode.to_s)
|
||||
store_preloaded("activatedThemes", activated_themes_json)
|
||||
end
|
||||
|
||||
@ -876,11 +877,6 @@ class ApplicationController < ActionController::Base
|
||||
!disqualified_from_2fa_enforcement && enforcing_2fa && !current_user.has_any_second_factor_methods_enabled?
|
||||
end
|
||||
|
||||
def block_if_readonly_mode
|
||||
return if request.fullpath.start_with?(path "/admin/backups")
|
||||
raise Discourse::ReadOnly.new if !(request.get? || request.head?) && @readonly_mode
|
||||
end
|
||||
|
||||
def build_not_found_page(opts = {})
|
||||
if SiteSetting.bootstrap_error_pages?
|
||||
preload_json
|
||||
|
Reference in New Issue
Block a user