diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 3899b4042f2..45464246066 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -662,6 +662,8 @@ 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