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 ...@@ -35,6 +35,10 @@ Rails.application.routes.draw do
post :approve_access_request, on: :member post :approve_access_request, on: :member
end end
concern :awardable do
post :toggle_award_emoji, on: :member
end
namespace :ci do namespace :ci do
# CI API # CI API
Ci::API::API.logger Rails.logger Ci::API::API.logger Rails.logger
...@@ -98,10 +102,9 @@ Rails.application.routes.draw do ...@@ -98,10 +102,9 @@ Rails.application.routes.draw do
# #
# Global snippets # Global snippets
# #
resources :snippets do resources :snippets, concerns: :awardable do
member do member do
get 'raw' get 'raw'
post :toggle_award_emoji
end end
end end
...@@ -662,7 +665,7 @@ Rails.application.routes.draw do ...@@ -662,7 +665,7 @@ Rails.application.routes.draw do
end end
end end
resources :snippets, constraints: { id: /\d+/ } do resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do
member do member do
get 'raw' get 'raw'
post :toggle_award_emoji post :toggle_award_emoji
...@@ -725,7 +728,7 @@ Rails.application.routes.draw do ...@@ -725,7 +728,7 @@ Rails.application.routes.draw do
end end
end end
resources :merge_requests, constraints: { id: /\d+/ } do resources :merge_requests, concerns: :awardable, constraints: { id: /\d+/ } do
member do member do
get :commits get :commits
get :diffs get :diffs
...@@ -737,7 +740,6 @@ Rails.application.routes.draw do ...@@ -737,7 +740,6 @@ Rails.application.routes.draw do
post :cancel_merge_when_build_succeeds post :cancel_merge_when_build_succeeds
get :ci_status get :ci_status
post :toggle_subscription post :toggle_subscription
post :toggle_award_emoji
post :remove_wip post :remove_wip
get :diff_for_path get :diff_for_path
post :resolve_conflicts post :resolve_conflicts
...@@ -839,10 +841,9 @@ Rails.application.routes.draw do ...@@ -839,10 +841,9 @@ Rails.application.routes.draw do
end end
end end
resources :issues, constraints: { id: /\d+/ } do resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do
member do member do
post :toggle_subscription post :toggle_subscription
post :toggle_award_emoji
post :mark_as_spam post :mark_as_spam
get :referenced_merge_requests get :referenced_merge_requests
get :related_branches get :related_branches
...@@ -870,9 +871,8 @@ Rails.application.routes.draw do ...@@ -870,9 +871,8 @@ Rails.application.routes.draw do
resources :group_links, only: [:index, :create, :destroy], constraints: { id: /\d+/ } 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 member do
post :toggle_award_emoji
delete :delete_attachment delete :delete_attachment
post :resolve post :resolve
delete :resolve, action: :unresolve 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