pundit: convert moderation reports to pundit.

This commit is contained in:
evazion
2020-03-17 23:09:32 -05:00
parent 480f39c34a
commit 9242bf522b
16 changed files with 60 additions and 58 deletions

View File

@@ -0,0 +1,13 @@
class ModerationReportPolicy < ApplicationPolicy
def index?
user.is_moderator?
end
def create?
unbanned? && policy(record.model).reportable?
end
def permitted_attributes
[:model_type, :model_id, :reason]
end
end