Staff can enter and view deleted topics

This commit is contained in:
Robin Ward
2013-07-11 16:38:46 -04:00
parent eba662b988
commit 19c169540c
24 changed files with 176 additions and 83 deletions

View File

@ -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