diff --git a/app/models/moderation_report.rb b/app/models/moderation_report.rb index ff975f2cc..17083458b 100644 --- a/app/models/moderation_report.rb +++ b/app/models/moderation_report.rb @@ -77,7 +77,7 @@ class ModerationReport < ApplicationRecord end end - def self.visible(user = CurrentUser.user) + def self.visible(user) user.is_moderator? ? all : none end diff --git a/app/views/comments/index_for_post.js.erb b/app/views/comments/index_for_post.js.erb index bc48cb554..3381caf97 100644 --- a/app/views/comments/index_for_post.js.erb +++ b/app/views/comments/index_for_post.js.erb @@ -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(partial: 'comments/partials/show/comment', collection: @comments, locals: { context: :index_for_post, dtext_data: DText.preprocess(@comments.map(&:body)), moderation_reports: @post.moderation_reports.visible.recent })) %>"); +current_comment_section.html("<%= j(render(partial: 'comments/partials/show/comment', collection: @comments, locals: { context: :index_for_post, dtext_data: DText.preprocess(@comments.map(&:body)), moderation_reports: @post.moderation_reports.visible(CurrentUser.user).recent })) %>"); $(window).trigger("danbooru:index_for_post", [<%= @post.id %>]); diff --git a/app/views/comments/partials/index/_list.html.erb b/app/views/comments/partials/index/_list.html.erb index a098389a8..4b0d9935c 100644 --- a/app/views/comments/partials/index/_list.html.erb +++ b/app/views/comments/partials/index/_list.html.erb @@ -3,10 +3,10 @@ <%= render "comments/partials/index/header", :post => post %> <% end %> - <% if post.moderation_reports.visible.recent.present? %> + <% if post.moderation_reports.visible(CurrentUser.user).recent.present? %>
- This post has comments reported for moderation! (<%= pluralize(post.moderation_reports.visible.recent.length, "report") %>) + This post has comments reported for moderation! (<%= pluralize(post.moderation_reports.visible(CurrentUser.user).recent.length, "report") %>)
<% end %> @@ -20,7 +20,7 @@
<% if comments.present? %> - <%= render partial: "comments/partials/show/comment", collection: comments, locals: { context: :index_by_post, dtext_data: DText.preprocess(comments.map(&:body)), moderation_reports: post.moderation_reports.visible.recent } %> + <%= render partial: "comments/partials/show/comment", collection: comments, locals: { context: :index_by_post, dtext_data: DText.preprocess(comments.map(&:body)), moderation_reports: post.moderation_reports.visible(CurrentUser.user).recent } %> <% elsif post.last_commented_at.present? %>

There are no visible comments.

<% else %> diff --git a/app/views/forum_topics/show.html.erb b/app/views/forum_topics/show.html.erb index 0ba9ca117..84b8b1ea5 100644 --- a/app/views/forum_topics/show.html.erb +++ b/app/views/forum_topics/show.html.erb @@ -26,7 +26,7 @@
<% 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.recent %> + <%= 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 %> <% if policy(ForumPost.new(topic: @forum_topic)).create? %>

<%= link_to "Post reply", new_forum_post_path(topic_id: @forum_topic.id), id: "new-response-link" %>

diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 63fcc8ef3..ce75914bc 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -5,10 +5,10 @@

<%= link_to_user @user %>

- <% if @user.moderation_reports.visible.recent.present? %> + <% if @user.moderation_reports.visible(CurrentUser.user).recent.present? %>
- This user has been reported for moderation! (<%= pluralize(@user.moderation_reports.visible.recent.length, "report") %>) + This user has been reported for moderation! (<%= pluralize(@user.moderation_reports.visible(CurrentUser.user).recent.length, "report") %>)
<% end %>