0
0
Fork 0

Move create/destroy actions for api/v1/statuses to namespace (#3678)

Each of mute, favourite, reblog has been updated to:

- Have a separate controller with just a create and destroy action
- Preserve historical route names to not break the API
- Mild refactoring to break up long methods
This commit is contained in:
Matt Jankowski 2017-06-10 03:39:26 -04:00 committed by Eugen Rochko
parent 778430b54a
commit 2925372ff4
10 changed files with 341 additions and 198 deletions

View file

@ -129,22 +129,21 @@ Rails.application.routes.draw do
namespace :v1 do
resources :statuses, only: [:create, :show, :destroy] do
scope module: :statuses do
with_options only: :index do
resources :reblogged_by, controller: :reblogged_by_accounts
resources :favourited_by, controller: :favourited_by_accounts
end
resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
resources :favourited_by, controller: :favourited_by_accounts, only: :index
resource :reblog, only: :create
post :unreblog, to: 'reblogs#destroy'
resource :favourite, only: :create
post :unfavourite, to: 'favourites#destroy'
resource :mute, only: :create
post :unmute, to: 'mutes#destroy'
end
member do
get :context
get :card
post :reblog
post :unreblog
post :favourite
post :unfavourite
post :mute
post :unmute
end
end