From 2925372ff44347fa7066c380a5d51dd35f80682f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sat, 10 Jun 2017 03:39:26 -0400 Subject: 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 --- config/routes.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'config') diff --git a/config/routes.rb b/config/routes.rb index d0236a43a..601330d39 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 -- cgit