Fix #4703: Report notice for forum posts is visible to non-moderators.

This commit is contained in:
evazion
2021-02-06 15:04:27 -06:00
parent 1eb094c862
commit 70ab7c50e6
2 changed files with 2 additions and 2 deletions

View File

@@ -28,6 +28,6 @@ class ForumPostComponent < ApplicationComponent
end
def has_moderation_reports?
policy(ModerationReport).show? && forum_post.moderation_reports.present?
policy(ModerationReport).can_see_moderation_reports? && forum_post.moderation_reports.present?
end
end

View File

@@ -35,7 +35,7 @@ class ForumPostComponentTest < ViewComponent::TestCase
end
should "not show the report notice to regular users" do
render_forum_post(@forum_post, current_user: User.anonymous)
render_forum_post(@forum_post, current_user: create(:user))
assert_no_css(".moderation-report-notice")
end