FIX: Unknown /posts/id.json should 404

This commit is contained in:
riking 2014-09-10 18:10:27 -07:00
parent 5cb7c8ee11
commit b62699707d

View File

@ -382,6 +382,7 @@ class PostsController < ApplicationController
# Include deleted posts if the user is staff
finder = finder.with_deleted if current_user.try(:staff?)
post = finder.first
raise Discourse::NotFound unless post
# load deleted topic
post.topic = Topic.with_deleted.find(post.topic_id) if current_user.try(:staff?)
guardian.ensure_can_see!(post)