Files
danbooru/app/policies/comment_vote_policy.rb
evazion b3c1c753b3 comments: allow admins to remove comment votes (fix #4640)
Allow admins to remove comment votes by other users. This is done by
clicking the comment score to get to the comment vote list, then
clicking the Remove button on every vote.
2021-03-30 00:10:25 -05:00

14 lines
259 B
Ruby

class CommentVotePolicy < ApplicationPolicy
def create?
unbanned? && !record.comment.is_deleted?
end
def destroy?
!record.is_deleted? && (record.user_id == user.id || user.is_admin?)
end
def can_see_votes?
user.is_moderator?
end
end