don't error out on not posts if its a json request

This commit is contained in:
Sam 2013-05-20 17:32:53 +10:00
parent fc57578c85
commit a3dce9afd7

View file

@ -28,7 +28,7 @@ class TopicsController < ApplicationController
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?
raise Discourse::NotFound unless @topic_view.posts.present? || (request.format && request.format.json?)
anonymous_etag(@topic_view.topic) do
redirect_to_correct_topic && return if slugs_do_not_match