Allow post disapprovals to be edited

This commit is contained in:
nonamethanks
2022-04-11 20:48:10 +02:00
parent 05261bf6d7
commit 1a990d5ab9
11 changed files with 76 additions and 19 deletions

View File

@@ -9,10 +9,22 @@ class PostDisapprovalPolicy < ApplicationPolicy
user.is_moderator? || record.user_id == user.id
end
def permitted_attributes
def permitted_attributes_for_create
[:post_id, :reason, :message]
end
def permitted_attributes_for_update
[:reason, :message]
end
def edit?
update?
end
def update?
unbanned? && record.post.in_modqueue? && record.user_id == user.id
end
def api_attributes
attributes = super
attributes -= [:user_id] unless can_view_creator?