Files
danbooru/app/policies/post_vote_policy.rb
evazion ab6d9bd0e8 post votes: fix exception when voting on posts using API.
Fix an `undefined method post_vote_url` exception when doing
`POST https://danbooru.donmai.us/posts/1/votes.json`.

Also add the following API endpoints:

* https://danbooru.donmai.us/post_votes/:id.json
* https://danbooru.donmai.us/comment_votes/:id.json
* https://danbooru.donmai.us/forum_post_votes/:id.json

where `:id` is the vote ID, not the post ID.
2021-11-14 20:11:38 -06:00

14 lines
216 B
Ruby

class PostVotePolicy < ApplicationPolicy
def create?
unbanned? && user.is_gold?
end
def destroy?
unbanned? && record.user == user
end
def show?
user.is_admin? || record.user == user
end
end