From 5684d666a942c705c79d28edf23a478c68702d7c Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 31 Oct 2024 18:05:34 +0100 Subject: [PATCH] Use concern for routes --- config/routes.rb | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index eb0e81d7e7..d90b171d45 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -125,7 +125,7 @@ Rails.application.routes.draw do get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" } - resources :accounts, path: 'users', only: [:show], param: :username do + concern :account_resources do resources :statuses, only: [:show] do member do get :activity @@ -148,28 +148,8 @@ Rails.application.routes.draw do end end - resources :accounts, path: 'u', only: [:show], param: :id, as: :numeric_account do - resources :statuses, only: [:show] do - member do - get :activity - get :embed - end - - resources :replies, only: [:index], module: :activitypub - resources :likes, only: [:index], module: :activitypub - resources :shares, only: [:index], module: :activitypub - end - - resources :followers, only: [:index], controller: :follower_accounts - resources :following, only: [:index], controller: :following_accounts - - scope module: :activitypub do - resource :outbox, only: [:show] - resource :inbox, only: [:create] - resources :collections, only: [:show] - resource :followers_synchronization, only: [:show] - end - end + resources :accounts, path: 'users', only: [:show], param: :username, concerns: :account_resources + resources :accounts, path: 'u', only: [:show], param: :id, as: :numeric_account, concerns: :account_resources resource :inbox, only: [:create], module: :activitypub