* Add ability to mark moderation reports as 'handled' or 'rejected'. * Automatically mark reports as handled when the comment or forum post is deleted. * Send a dmail to the reporter when their report is handled. * Don't show the report notice on comments or forum posts when all reports against it have been handled or rejected. * Add a fix script to mark all existing reports for deleted comments, forum posts, or dmails as handled.
32 lines
491 B
Ruby
32 lines
491 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ModerationReportPolicy < ApplicationPolicy
|
|
def index?
|
|
!user.is_anonymous?
|
|
end
|
|
|
|
def show?
|
|
!user.is_anonymous?
|
|
end
|
|
|
|
def create?
|
|
unbanned? && policy(record.model).reportable?
|
|
end
|
|
|
|
def update?
|
|
user.is_moderator?
|
|
end
|
|
|
|
def can_see_moderation_reports?
|
|
user.is_moderator?
|
|
end
|
|
|
|
def permitted_attributes_for_create
|
|
[:model_type, :model_id, :reason]
|
|
end
|
|
|
|
def permitted_attributes_for_update
|
|
[:status]
|
|
end
|
|
end
|