Commit 0b67d22b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Peter Leitzen

Refactor some routing code

- Keep project.rb and group.rb files about single resource route
- Group some draw blocks together
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 4ffc1a8b
...@@ -120,9 +120,7 @@ Rails.application.routes.draw do ...@@ -120,9 +120,7 @@ Rails.application.routes.draw do
draw :country draw :country
draw :country_state draw :country_state
draw :subscription draw :subscription
end
Gitlab.ee do
constraints(-> (*) { Gitlab::Analytics.any_features_enabled? }) do constraints(-> (*) { Gitlab::Analytics.any_features_enabled? }) do
draw :analytics draw :analytics
end end
...@@ -168,11 +166,6 @@ Rails.application.routes.draw do ...@@ -168,11 +166,6 @@ Rails.application.routes.draw do
end end
end end
draw :api
draw :sidekiq
draw :help
draw :snippets
# Invites # Invites
resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
member do member do
...@@ -193,6 +186,25 @@ Rails.application.routes.draw do ...@@ -193,6 +186,25 @@ Rails.application.routes.draw do
# Notification settings # Notification settings
resources :notification_settings, only: [:create, :update] resources :notification_settings, only: [:create, :update]
resources :groups, only: [:index, :new, :create] do
post :preview_markdown
end
resources :projects, only: [:index, :new, :create]
get '/projects/:id' => 'projects#resolve'
Gitlab.ee do
scope '/-/push_from_secondary/:geo_node_id' do
draw :git_http
end
end
draw :git_http
draw :api
draw :sidekiq
draw :help
draw :snippets
draw :google_api draw :google_api
draw :import draw :import
draw :uploads draw :uploads
......
# frozen_string_literal: true # frozen_string_literal: true
# rubocop: disable Cop/PutGroupRoutesUnderScope
resources :groups, only: [:index, :new, :create] do
post :preview_markdown
end
# rubocop: enable Cop/PutGroupRoutesUnderScope
constraints(::Constraints::GroupUrlConstrainer.new) do constraints(::Constraints::GroupUrlConstrainer.new) do
scope(path: 'groups/*id', scope(path: 'groups/*id',
controller: :groups, controller: :groups,
......
# frozen_string_literal: true # frozen_string_literal: true
# rubocop: disable Cop/PutProjectRoutesUnderScope
resources :projects, only: [:index, :new, :create]
draw :git_http
get '/projects/:id' => 'projects#resolve'
# rubocop: enable Cop/PutProjectRoutesUnderScope
constraints(::Constraints::ProjectUrlConstrainer.new) do constraints(::Constraints::ProjectUrlConstrainer.new) do
# If the route has a wildcard segment, the segment has a regex constraint, # If the route has a wildcard segment, the segment has a regex constraint,
# the segment is potentially followed by _another_ wildcard segment, and # the segment is potentially followed by _another_ wildcard segment, and
......
# frozen_string_literal: true # frozen_string_literal: true
scope "/-/push_from_secondary/:geo_node_id" do
draw :git_http
end
constraints(::Constraints::ProjectUrlConstrainer.new) do constraints(::Constraints::ProjectUrlConstrainer.new) do
scope(path: '*namespace_id', scope(path: '*namespace_id',
as: :namespace, as: :namespace,
......
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