don't error out on not posts if its a json request
This commit is contained in:
parent
fc57578c85
commit
a3dce9afd7
|
@ -28,7 +28,7 @@ class TopicsController < ApplicationController
|
||||||
opts = params.slice(:username_filters, :best_of, :page, :post_number, :posts_before, :posts_after, :best)
|
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)
|
@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
|
anonymous_etag(@topic_view.topic) do
|
||||||
redirect_to_correct_topic && return if slugs_do_not_match
|
redirect_to_correct_topic && return if slugs_do_not_match
|
||||||
|
|
Loading…
Reference in New Issue