Fix #4525: Show mod report notices next to reported content.

This commit is contained in:
evazion
2021-01-15 19:54:21 -06:00
parent 37792bd5dd
commit b4530183f4
20 changed files with 153 additions and 57 deletions

View File

@@ -9,7 +9,7 @@
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
<% end %>
</div>
<%= render_comment(comment, dtext_data: dtext_data, context: :index_by_comment, show_deleted: params.dig(:search, :is_deleted).to_s.truthy?) %>
<%= render_comment(comment, dtext_data: dtext_data, context: :index_by_comment, show_deleted: params.dig(:search, :is_deleted).to_s.truthy?, current_user: CurrentUser.user) %>
<% end %>
<% end %>
<% end %>

View File

@@ -1,5 +1,5 @@
$("#threshold-comments-notice-for-<%= @post.id %>").hide();
var current_comment_section = $("div.comments-for-post[data-post-id=<%= @post.id %>] div.list-of-comments");
current_comment_section.html("<%= j render_comment_list(@comments, context: :index_by_post, moderation_reports: @post.moderation_reports.visible(CurrentUser.user).recent) %>");
current_comment_section.html("<%= j render_comment_list(@comments, context: :index_by_post) %>");
$(window).trigger("danbooru:index_for_post", [<%= @post.id %>]);

View File

@@ -3,13 +3,6 @@
<%= render "comments/partials/index/header", :post => post %>
<% end %>
<% if post.moderation_reports.visible(CurrentUser.user).recent.present? %>
<div class="row moderation-comments-notice">
<span class="info" id="moderation-comments-notice-for-<%= post.id %>">
This post has comments reported for moderation! (<%= pluralize(post.moderation_reports.visible(CurrentUser.user).recent.length, "report") %>)
</span>
</div>
<% end %>
<% if post.comments.hidden(CurrentUser.user).any? || (page == :comments && post.comments.size > 6) %>
<div class="row hidden-comments-notice">
<span class="info" id="threshold-comments-notice-for-<%= post.id %>">
@@ -20,7 +13,7 @@
<div class="list-of-comments list-of-messages">
<% if comments.present? %>
<%= render_comment_list(comments, context: :index_by_post, moderation_reports: post.moderation_reports.visible(CurrentUser.user).recent) %>
<%= render_comment_list(comments, context: :index_by_post) %>
<% elsif post.last_commented_at.present? %>
<p>There are no visible comments.</p>
<% else %>