diff --git a/config/routes.rb b/config/routes.rb index 39a441acdb6d40dbcdbc0468a73daae6b5c625e4..de8595c54afe36731e1402f8ff786742766ddb13 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,6 +86,8 @@ # Terraform service discovery get '.well-known/terraform.json' => 'terraform/services#index', as: :terraform_services + draw :organizations + # Begin of the /-/ scope. # Use this scope for all new global routes. scope path: '-' do @@ -170,7 +172,6 @@ draw :operations draw :jira_connect - draw :organizations Gitlab.ee do draw 'remote_development/resources' diff --git a/config/routes/organizations.rb b/config/routes/organizations.rb index 30e11d3473b734aab76c4dcfa868157a94bd02c2..a8ce00cd7149c4103c49fbc6543821d09ae89e81 100644 --- a/config/routes/organizations.rb +++ b/config/routes/organizations.rb @@ -1,10 +1,16 @@ # frozen_string_literal: true -resources(:organizations, only: [:show, :index, :new], param: :organization_path, module: :organizations) do - collection do - post :preview_markdown +# Index and new actions use /-/organizations path +scope '-' do + resources(:organizations, only: [:index, :new], module: :organizations) do + collection do + post :preview_markdown + end end +end +# All routes for a specific organization use /o/ path +resources(:organizations, path: 'o', only: [:show], param: :organization_path, module: :organizations) do member do get :activity get :groups_and_projects diff --git a/doc/user/reserved_names.md b/doc/user/reserved_names.md index b8a6fb98983ddf08bc2c0c90d81050496a789ebb..299e1627afbf27cccc4b4de8f0eab2ab1f126d45 100644 --- a/doc/user/reserved_names.md +++ b/doc/user/reserved_names.md @@ -86,6 +86,7 @@ You cannot create groups with the following names, because they are reserved for - `import` - `jwt` - `login` +- `o` - `oauth` - `profile` - `projects` diff --git a/lib/gitlab/path_regex.rb b/lib/gitlab/path_regex.rb index 09bf048ce901ab0b95864744875a2774dba5e8cc..5d2ce6b2248948ff5453b6d136ff9fdb72655dfc 100644 --- a/lib/gitlab/path_regex.rb +++ b/lib/gitlab/path_regex.rb @@ -36,6 +36,7 @@ module PathRegex import jwt login + o oauth profile projects diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb index 434a2e153720a2df008b12e1f83e0c6eb1f994e5..786f9f989789ea3fcde4690f2857b1e510901764 100644 --- a/spec/lib/gitlab/path_regex_spec.rb +++ b/spec/lib/gitlab/path_regex_spec.rb @@ -194,7 +194,7 @@ def failure_message(constant_name, migration_helper, missing_words: [], addition # We ban new items in this list, see https://gitlab.com/gitlab-org/gitlab/-/issues/215362 it 'does not allow expansion' do - expect(described_class::TOP_LEVEL_ROUTES.size).to eq(38) + expect(described_class::TOP_LEVEL_ROUTES.size).to eq(39) end end