diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 17796b23238..3899b4042f2 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -662,9 +662,10 @@ 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?) + raise Discourse::NotFound unless post.topic + guardian.ensure_can_see!(post) post end