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.
This commit is contained in:
evazion
2021-11-14 20:11:38 -06:00
parent afae7aed07
commit ab6d9bd0e8
9 changed files with 97 additions and 3 deletions

View File

@@ -89,7 +89,7 @@ Rails.application.routes.draw do
post :approve
end
end
resources :comment_votes, only: [:index, :destroy]
resources :comment_votes, only: [:index, :show, :destroy]
resources :comments do
resource :votes, controller: "comment_votes", only: [:create, :destroy], as: "comment_votes"
collection do
@@ -134,7 +134,7 @@ Rails.application.routes.draw do
get :search
end
end
resources :forum_post_votes, only: [:index, :create, :destroy]
resources :forum_post_votes, only: [:index, :show, :create, :destroy]
resources :forum_topics do
member do
post :undelete
@@ -189,7 +189,7 @@ Rails.application.routes.draw do
end
resources :post_regenerations, :only => [:create]
resources :post_replacements, :only => [:index, :new, :create, :update]
resources :post_votes, only: [:index]
resources :post_votes, only: [:index, :show]
# XXX Use `only: []` to avoid redefining post routes defined at top of file.
resources :posts, only: [] do