pundit: convert moderation reports to pundit.
This commit is contained in:
13
app/policies/moderation_report_policy.rb
Normal file
13
app/policies/moderation_report_policy.rb
Normal 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
|
||||
Reference in New Issue
Block a user