get rid of nonsense 404.html

correct 404 handling for invalid pages
This commit is contained in:
Sam
2013-05-20 10:29:49 +10:00
parent 18b00d01d0
commit 80fb20816c
7 changed files with 20 additions and 59 deletions

View File

@ -25,7 +25,10 @@ class TopicsController < ApplicationController
caches_action :avatar, cache_path: Proc.new {|c| "#{c.params[:post_number]}-#{c.params[:topic_id]}" }
def show
create_topic_view
opts = params.slice(:username_filters, :best_of, :page, :post_number, :posts_before, :posts_after, :best)
@topic_view = TopicView.new(params[:id] || params[:topic_id], current_user, opts)
raise Discourse::NotFound unless @topic_view.posts.present?
anonymous_etag(@topic_view.topic) do
redirect_to_correct_topic && return if slugs_do_not_match
@ -196,11 +199,6 @@ class TopicsController < ApplicationController
private
def create_topic_view
opts = params.slice(:username_filters, :best_of, :page, :post_number, :posts_before, :posts_after, :best)
@topic_view = TopicView.new(params[:id] || params[:topic_id], current_user, opts)
end
def toggle_mute(v)
@topic = Topic.where(id: params[:topic_id].to_i).first
guardian.ensure_can_see!(@topic)