mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Staff can enter and view deleted topics
This commit is contained in:
@ -74,9 +74,9 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def rescue_discourse_actions(message, error)
|
||||
if request.format && request.format.json?
|
||||
render status: error, layout: false, text: message
|
||||
render status: error, layout: false, text: (error == 404) ? build_not_found_page(error) : message
|
||||
else
|
||||
render_not_found_page(error)
|
||||
render text: build_not_found_page(error, 'no_js')
|
||||
end
|
||||
end
|
||||
|
||||
@ -123,7 +123,6 @@ class ApplicationController < ActionController::Base
|
||||
@guardian ||= Guardian.new(current_user)
|
||||
end
|
||||
|
||||
|
||||
def serialize_data(obj, serializer, opts={})
|
||||
# If it's an array, apply the serializer as an each_serializer to the elements
|
||||
serializer_opts = {scope: guardian}.merge!(opts)
|
||||
@ -261,13 +260,13 @@ class ApplicationController < ActionController::Base
|
||||
redirect_to :login if SiteSetting.login_required? && !current_user
|
||||
end
|
||||
|
||||
def render_not_found_page(status=404)
|
||||
def build_not_found_page(status=404, layout=false)
|
||||
@top_viewed = TopicQuery.top_viewed(10)
|
||||
@recent = TopicQuery.recent(10)
|
||||
@slug = params[:slug].class == String ? params[:slug] : ''
|
||||
@slug = (params[:id].class == String ? params[:id] : '') if @slug.blank?
|
||||
@slug.gsub!('-',' ')
|
||||
render status: status, layout: 'no_js', formats: [:html], template: '/exceptions/not_found'
|
||||
render_to_string status: status, layout: layout, formats: [:html], template: '/exceptions/not_found'
|
||||
end
|
||||
|
||||
protected
|
||||
|
Reference in New Issue
Block a user