Fix #4145: Unable to view deleted comments from post page.
Bug: if all the comments on a post were deleted then the deleted comments wouldn't be visible to moderators. This was because we assumed that if `last_commented_at` was nil it meant that the post had no comments, but this was wrong. `last_commented_at` only counts undeleted comments. It's reset to nil if all the commnets have been deleted.
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
<% end %>
|
||||
|
||||
<div class="row notices">
|
||||
<% if (post.last_commented_at.present? && post.comments.any? { |c| !c.visible_by?(CurrentUser.user) }) || (page == :comments && post.comments.size > 6) %>
|
||||
<% if post.comments.any? { |c| !c.visible_by?(CurrentUser.user, show_deleted: true) } || (page == :comments && post.comments.size > 6) %>
|
||||
<span class="info" id="threshold-comments-notice-for-<%= post.id %>">
|
||||
<%= link_to "Show all comments", comments_path(:post_id => post.id), :remote => true %>
|
||||
<%= link_to "Show all comments", comments_path(post_id: post.id), id: "show-all-comments-link", remote: true %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user