mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 00:41:16 +08:00
FIX: Make read only errors respect the request format (#16741)
This commit is contained in:

committed by
GitHub

parent
18ebe2fc28
commit
1d7e423f86
@ -246,7 +246,14 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
rescue_from Discourse::ReadOnly do
|
rescue_from Discourse::ReadOnly do
|
||||||
unless response_body
|
unless response_body
|
||||||
render_json_error I18n.t('read_only_mode_enabled'), type: :read_only, status: 503
|
respond_to do |format|
|
||||||
|
format.json do
|
||||||
|
render_json_error I18n.t('read_only_mode_enabled'), type: :read_only, status: 503
|
||||||
|
end
|
||||||
|
format.html do
|
||||||
|
render status: 503, layout: 'no_ember', template: 'exceptions/read_only'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
1
app/views/exceptions/read_only.html.erb
Normal file
1
app/views/exceptions/read_only.html.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
<p><%= t('read_only_mode_enabled') %></p>
|
Reference in New Issue
Block a user