Commit 86e7ae82 authored by Z.J. van de Weg's avatar Z.J. van de Weg Committed by Fatih Acet

Use routing concerns to DRY the routes

parent e8dd0d54
......@@ -35,6 +35,10 @@ Rails.application.routes.draw do
post :approve_access_request, on: :member
end
concern :awardable do
post :toggle_award_emoji, on: :member
end
namespace :ci do
# CI API
Ci::API::API.logger Rails.logger
......@@ -98,10 +102,9 @@ Rails.application.routes.draw do
#
# Global snippets
#
resources :snippets do
resources :snippets, concerns: :awardable do
member do
get 'raw'
post :toggle_award_emoji
end
end
......@@ -662,7 +665,7 @@ Rails.application.routes.draw do
end
end
resources :snippets, constraints: { id: /\d+/ } do
resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do
member do
get 'raw'
post :toggle_award_emoji
......@@ -725,7 +728,7 @@ Rails.application.routes.draw do
end
end
resources :merge_requests, constraints: { id: /\d+/ } do
resources :merge_requests, concerns: :awardable, constraints: { id: /\d+/ } do
member do
get :commits
get :diffs
......@@ -737,7 +740,6 @@ Rails.application.routes.draw do
post :cancel_merge_when_build_succeeds
get :ci_status
post :toggle_subscription
post :toggle_award_emoji
post :remove_wip
get :diff_for_path
post :resolve_conflicts
......@@ -839,10 +841,9 @@ Rails.application.routes.draw do
end
end
resources :issues, constraints: { id: /\d+/ } do
resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do
member do
post :toggle_subscription
post :toggle_award_emoji
post :mark_as_spam
get :referenced_merge_requests
get :related_branches
......@@ -870,9 +871,8 @@ Rails.application.routes.draw do
resources :group_links, only: [:index, :create, :destroy], constraints: { id: /\d+/ }
resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
resources :notes, only: [:index, :create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do
member do
post :toggle_award_emoji
delete :delete_attachment
post :resolve
delete :resolve, action: :unresolve
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment