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 %>

View File

@@ -1,16 +0,0 @@
<%- # forum_post %>
<%- # original_forum_post_id %>
<%- # dtext_data %>
<%- # moderation_reports %>
<div class="list-of-forum-posts list-of-messages">
<% if moderation_reports.present? %>
<div class="row moderation-forums-notice">
<span class="info" id="moderation-forums-notice-for-topic">
This topic has forum posts reported for moderation! (<%= pluralize(moderation_reports.length, "report") %>)
</span>
</div>
<% end %>
<%= render ForumPostComponent.with_collection(forum_posts, original_forum_post_id: original_forum_post_id, dtext_data: dtext_data, moderation_reports: moderation_reports, current_user: CurrentUser.user) %>
</div>

View File

@@ -27,7 +27,9 @@
</div>
<% end %>
<%= render "forum_posts/listing", forum_posts: @forum_posts, original_forum_post_id: @forum_topic.original_post&.id, dtext_data: DText.preprocess(@forum_posts.map(&:body)), moderation_reports: @forum_topic.moderation_reports.visible(CurrentUser.user).recent %>
<div class="list-of-forum-posts list-of-messages">
<%= render ForumPostComponent.with_collection(@forum_posts, forum_topic: @forum_topic, current_user: CurrentUser.user) %>
</div>
<% if policy(ForumPost.new(topic: @forum_topic)).create? %>
<p><%= link_to "Post reply", new_forum_post_path(topic_id: @forum_topic.id), id: "new-response-link" %></p>