fixes #4079: Allow deleted forum items to be seen with the is_deleted parameter

This commit is contained in:
Albert Yi
2019-05-17 13:11:24 -07:00
parent 0a058dd52b
commit 21ba1000f1
2 changed files with 3 additions and 5 deletions

View File

@@ -162,8 +162,8 @@ class ForumPost < ApplicationRecord
(creator_id == user.id || user.is_moderator?) && visible?(user)
end
def visible?(user)
user.is_moderator? || (topic.visible?(user) && !is_deleted?)
def visible?(user, show_deleted_posts = false)
user.is_moderator? || (topic.visible?(user) && (show_deleted_posts || !is_deleted?))
end
def update_topic_updated_at_on_create