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.
14 lines
259 B
Ruby
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
|