Fix #4703: Report notice for forum posts is visible to non-moderators.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user