summaryrefslogtreecommitdiff
path: root/config/routes
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-22 20:08:33 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-23 20:38:35 -0500
commitb0498c176fa134761d899c9b369be12f1ca789c5 (patch)
treedcf223813e0b1bb5932a94793a6f827771517a96 /config/routes
parented16c351c5acdf1ad2e401e72490320d06af6e91 (diff)
downloadgitlab-ce-b0498c176fa134761d899c9b369be12f1ca789c5.tar.gz
Remove changes that are not absolutely necessarydm-fix-routes
Diffstat (limited to 'config/routes')
-rw-r--r--config/routes/admin.rb6
-rw-r--r--config/routes/git_http.rb6
-rw-r--r--config/routes/group.rb18
-rw-r--r--config/routes/project.rb10
-rw-r--r--config/routes/repository.rb6
-rw-r--r--config/routes/user.rb28
6 files changed, 30 insertions, 44 deletions
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index 6e34dd3a2eb..b1b6ef33a47 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -36,7 +36,7 @@ namespace :admin do
scope(path: 'groups/*id',
controller: :groups,
- constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do
+ constraints: { id: Gitlab::Regex.namespace_route_regex, format: /(html|json|atom)/ }) do
scope(as: :group) do
put :members_update
@@ -70,10 +70,10 @@ namespace :admin do
scope(path: 'projects/*namespace_id',
as: :namespace,
- constraints: { namespace_id: Gitlab::PathRegex.full_namespace_route_regex }) do
+ constraints: { namespace_id: Gitlab::Regex.namespace_route_regex }) do
resources(:projects,
path: '/',
- constraints: { id: Gitlab::PathRegex.project_route_regex },
+ constraints: { id: Gitlab::Regex.project_route_regex },
only: [:show]) do
member do
diff --git a/config/routes/git_http.rb b/config/routes/git_http.rb
index a53c94326d4..cdf658c3e4a 100644
--- a/config/routes/git_http.rb
+++ b/config/routes/git_http.rb
@@ -1,7 +1,7 @@
scope(path: '*namespace_id/:project_id',
format: nil,
- constraints: { namespace_id: Gitlab::PathRegex.full_namespace_route_regex }) do
- scope(constraints: { project_id: Gitlab::PathRegex.project_git_route_regex }, module: :projects) do
+ constraints: { namespace_id: Gitlab::Regex.namespace_route_regex }) do
+ scope(constraints: { project_id: Gitlab::Regex.project_git_route_regex }, module: :projects) do
# Git HTTP clients ('git clone' etc.)
scope(controller: :git_http) do
get '/info/refs', action: :info_refs
@@ -28,7 +28,7 @@ scope(path: '*namespace_id/:project_id',
end
# Redirect /group/project/info/refs to /group/project.git/info/refs
- scope(constraints: { project_id: Gitlab::PathRegex.project_route_regex }) do
+ scope(constraints: { project_id: Gitlab::Regex.project_route_regex }) do
# Allow /info/refs, /info/refs?service=git-upload-pack, and
# /info/refs?service=git-receive-pack, but nothing else.
#
diff --git a/config/routes/group.rb b/config/routes/group.rb
index 11cdff55ed8..7b29e0e807c 100644
--- a/config/routes/group.rb
+++ b/config/routes/group.rb
@@ -1,11 +1,9 @@
-require 'constraints/group_url_constrainer'
-
resources :groups, only: [:index, :new, :create]
scope(path: 'groups/*group_id',
module: :groups,
as: :group,
- constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do
+ constraints: { group_id: Gitlab::Regex.namespace_route_regex }) do
resources :group_members, only: [:index, :create, :update, :destroy], concerns: :access_requestable do
post :resend_invite, on: :member
delete :leave, on: :collection
@@ -27,7 +25,7 @@ end
scope(path: 'groups/*id',
controller: :groups,
- constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do
+ constraints: { id: Gitlab::Regex.namespace_route_regex, format: /(html|json|atom)/ }) do
get :edit, as: :edit_group
get :issues, as: :issues_group
get :merge_requests, as: :merge_requests_group
@@ -36,15 +34,3 @@ scope(path: 'groups/*id',
get :subgroups, as: :subgroups_group
get '/', action: :show, as: :group_canonical
end
-
-constraints(GroupUrlConstrainer.new) do
- scope(path: '*id',
- as: :group,
- constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ },
- controller: :groups) do
- get '/', action: :show
- patch '/', action: :update
- put '/', action: :update
- delete '/', action: :destroy
- end
-end
diff --git a/config/routes/project.rb b/config/routes/project.rb
index a2bc63a4734..9fe8372edf9 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -13,16 +13,16 @@ constraints(ProjectUrlConstrainer.new) do
# Otherwise, Rails will overwrite the constraint with `/.+?/`,
# which breaks some of our wildcard routes like `/blob/*id`
# and `/tree/*id` that depend on the negative lookahead inside
- # `Gitlab::PathRegex.full_namespace_route_regex`, which helps the router
+ # `Gitlab::Regex.namespace_route_regex`, which helps the router
# determine whether a certain path segment is part of `*namespace_id`,
# `:project_id`, or `*id`.
#
# See https://github.com/rails/rails/blob/v4.2.8/actionpack/lib/action_dispatch/routing/mapper.rb#L155
scope(path: '*namespace_id',
as: :namespace,
- namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do
+ namespace_id: Gitlab::Regex.namespace_route_regex) do
scope(path: ':project_id',
- constraints: { project_id: Gitlab::PathRegex.project_route_regex },
+ constraints: { project_id: Gitlab::Regex.project_route_regex },
module: :projects,
as: :project) do
@@ -329,7 +329,7 @@ constraints(ProjectUrlConstrainer.new) do
resources :runner_projects, only: [:create, :destroy]
resources :badges, only: [:index] do
collection do
- scope '*ref', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do
+ scope '*ref', constraints: { ref: Gitlab::Regex.git_reference_regex } do
constraints format: /svg/ do
get :build
get :coverage
@@ -352,7 +352,7 @@ constraints(ProjectUrlConstrainer.new) do
resources(:projects,
path: '/',
- constraints: { id: Gitlab::PathRegex.project_route_regex },
+ constraints: { id: Gitlab::Regex.project_route_regex },
only: [:edit, :show, :update, :destroy]) do
member do
put :transfer
diff --git a/config/routes/repository.rb b/config/routes/repository.rb
index 11911636fa7..5cf37a06e97 100644
--- a/config/routes/repository.rb
+++ b/config/routes/repository.rb
@@ -2,7 +2,7 @@
resource :repository, only: [:create] do
member do
- get 'archive', constraints: { format: Gitlab::PathRegex.archive_formats_regex }
+ get 'archive', constraints: { format: Gitlab::Regex.archive_formats_regex }
end
end
@@ -24,7 +24,7 @@ scope format: false do
member do
# tree viewer logs
- get 'logs_tree', constraints: { id: Gitlab::PathRegex.git_reference_regex }
+ get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex }
# Directories with leading dots erroneously get rejected if git
# ref regex used in constraints. Regex verification now done in controller.
get 'logs_tree/*path', action: :logs_tree, as: :logs_file, format: false, constraints: {
@@ -34,7 +34,7 @@ scope format: false do
end
end
- scope constraints: { id: Gitlab::PathRegex.git_reference_regex } do
+ scope constraints: { id: Gitlab::Regex.git_reference_regex } do
resources :network, only: [:show]
resources :graphs, only: [:show] do
diff --git a/config/routes/user.rb b/config/routes/user.rb
index e682dcd6663..0f3bec9cf58 100644
--- a/config/routes/user.rb
+++ b/config/routes/user.rb
@@ -11,7 +11,19 @@ devise_scope :user do
get '/users/almost_there' => 'confirmations#almost_there'
end
-scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) do
+constraints(UserUrlConstrainer.new) do
+ # Get all keys of user
+ get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: Gitlab::Regex.root_namespace_route_regex }
+
+ scope(path: ':username',
+ as: :user,
+ constraints: { username: Gitlab::Regex.root_namespace_route_regex },
+ controller: :users) do
+ get '/', action: :show
+ end
+end
+
+scope(constraints: { username: Gitlab::Regex.root_namespace_route_regex }) do
scope(path: 'users/:username',
as: :user,
controller: :users) do
@@ -22,7 +34,7 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d
get :contributed, as: :contributed_projects
get :snippets
get :exists
- get '/', to: redirect('/%{username}'), as: nil
+ get '/', to: redirect('/%{username}')
end
# Compatibility with old routing
@@ -34,15 +46,3 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d
get '/u/:username/snippets', to: redirect('/users/%{username}/snippets')
get '/u/:username/contributed', to: redirect('/users/%{username}/contributed')
end
-
-constraints(UserUrlConstrainer.new) do
- # Get all keys of user
- get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }
-
- scope(path: ':username',
- as: :user,
- constraints: { username: Gitlab::PathRegex.root_namespace_route_regex },
- controller: :users) do
- get '/', action: :show
- end
-end