diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /config/routes | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'config/routes')
-rw-r--r-- | config/routes/admin.rb | 42 | ||||
-rw-r--r-- | config/routes/directs.rb | 1 | ||||
-rw-r--r-- | config/routes/directs/subscription_portal.rb | 19 | ||||
-rw-r--r-- | config/routes/group.rb | 37 | ||||
-rw-r--r-- | config/routes/import.rb | 11 | ||||
-rw-r--r-- | config/routes/issues.rb | 9 | ||||
-rw-r--r-- | config/routes/jira_connect.rb | 1 | ||||
-rw-r--r-- | config/routes/pipelines.rb | 1 | ||||
-rw-r--r-- | config/routes/profile.rb | 16 | ||||
-rw-r--r-- | config/routes/project.rb | 112 | ||||
-rw-r--r-- | config/routes/repository.rb | 2 | ||||
-rw-r--r-- | config/routes/repository_deprecated.rb | 19 | ||||
-rw-r--r-- | config/routes/snippets.rb | 2 | ||||
-rw-r--r-- | config/routes/unmatched_project.rb | 16 | ||||
-rw-r--r-- | config/routes/uploads.rb | 22 | ||||
-rw-r--r-- | config/routes/user.rb | 16 |
16 files changed, 180 insertions, 146 deletions
diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 9181c1c94cf..d9cd60f8086 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -35,7 +35,7 @@ namespace :admin do resource :impersonation, only: :destroy - resources :abuse_reports, only: [:index, :destroy] + resources :abuse_reports, only: [:index, :show, :update, :destroy] resources :gitaly_servers, only: [:index] resources :spam_logs, only: [:index, :destroy] do @@ -44,13 +44,17 @@ namespace :admin do end end - resources :applications + resources :applications do + put 'renew', on: :member + end resources :groups, only: [:index, :new, :create] - scope(path: 'groups/*id', - controller: :groups, - constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do + scope( + path: 'groups/*id', + controller: :groups, + constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ } + ) do scope(as: :group) do put :members_update get :edit, action: :edit @@ -111,16 +115,24 @@ namespace :admin do get 'dev_ops_report', to: redirect('admin/dev_ops_reports') resources :cohorts, only: :index - scope(path: 'projects/*namespace_id', - as: :namespace, - constraints: { namespace_id: Gitlab::PathRegex.full_namespace_route_regex }) do - resources(:projects, - path: '/', - constraints: { id: Gitlab::PathRegex.project_route_regex }, - only: [:show, :destroy]) do + scope( + path: 'projects/*namespace_id', + as: :namespace, + constraints: { namespace_id: Gitlab::PathRegex.full_namespace_route_regex } + ) do + resources( + :projects, + path: '/', + constraints: { id: Gitlab::PathRegex.project_route_regex }, + only: [:show, :destroy] + ) do member do put :transfer post :repository_check + get :edit, action: :edit + get '/', action: :show + patch '/', action: :update + put '/', action: :update end resources :runner_projects, only: [:create, :destroy] @@ -144,11 +156,6 @@ namespace :admin do match :general, :integrations, :repository, :ci_cd, :reporting, :metrics_and_profiling, :network, :preferences, via: [:get, :patch] get :lets_encrypt_terms_of_service - post :create_self_monitoring_project - get :status_create_self_monitoring_project - delete :delete_self_monitoring_project - get :status_delete_self_monitoring_project - get :service_usage_data resource :appearances, only: [:show, :create, :update], path: 'appearance', module: 'application_settings' do @@ -168,6 +175,7 @@ namespace :admin do resources :runners, only: [:index, :new, :show, :edit, :update, :destroy] do member do + get :register post :resume post :pause end diff --git a/config/routes/directs.rb b/config/routes/directs.rb index f28750b5c2e..407e2a9d8a5 100644 --- a/config/routes/directs.rb +++ b/config/routes/directs.rb @@ -3,3 +3,4 @@ # Custom URL definitions for the Community Edition. draw 'directs/milestone' +draw 'directs/subscription_portal' diff --git a/config/routes/directs/subscription_portal.rb b/config/routes/directs/subscription_portal.rb new file mode 100644 index 00000000000..188725d16c1 --- /dev/null +++ b/config/routes/directs/subscription_portal.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +direct :subscription_portal_staging do + ENV.fetch('STAGING_CUSTOMER_PORTAL_URL', 'https://customers.staging.gitlab.com') +end + +direct :subscription_portal do + default_subscriptions_url = if ::Gitlab.dev_or_test_env? + subscription_portal_staging_url + else + 'https://customers.gitlab.com' + end + + ENV.fetch('CUSTOMER_PORTAL_URL', default_subscriptions_url) +end + +direct :subscription_portal_instance_review do + Addressable::URI.join(subscription_portal_url, '/instance_review').to_s +end diff --git a/config/routes/group.rb b/config/routes/group.rb index 582f8bf9471..9b346867f78 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -1,9 +1,11 @@ # frozen_string_literal: true constraints(::Constraints::GroupUrlConstrainer.new) do - scope(path: 'groups/*id', - controller: :groups, - constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom|ics)/ }) do + scope( + path: 'groups/*id', + controller: :groups, + constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom|ics)/ } + ) do scope(path: '-') do # These routes are legit and the cop rule will be improved in # https://gitlab.com/gitlab-org/gitlab/-/issues/230703 @@ -27,10 +29,12 @@ constraints(::Constraints::GroupUrlConstrainer.new) do get '/', action: :show, as: :group_canonical end - scope(path: 'groups/*group_id/-', - module: :groups, - as: :group, - constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do + scope( + path: 'groups/*group_id/-', + module: :groups, + as: :group, + constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex } + ) do namespace :settings do resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do put :reset_registration_token @@ -56,7 +60,9 @@ constraints(::Constraints::GroupUrlConstrainer.new) do end end - resources :applications + resources :applications do + put 'renew', on: :member + end resource :packages_and_registries, only: [:show] end @@ -112,8 +118,9 @@ constraints(::Constraints::GroupUrlConstrainer.new) do resources :boards, only: [:index, :show], constraints: { id: /\d+/ } - resources :runners, only: [:index, :edit, :update, :destroy, :show] do + resources :runners, only: [:index, :new, :edit, :update, :destroy, :show] do member do + get :register post :resume post :pause end @@ -151,12 +158,16 @@ constraints(::Constraints::GroupUrlConstrainer.new) do resources :contacts, only: [:index, :new, :edit] resources :organizations, only: [:index, :new, :edit] end + + resources :achievements, only: [:index, :new, :edit] end - scope(path: '*id', - as: :group, - constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }, - controller: :groups) 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 diff --git a/config/routes/import.rb b/config/routes/import.rb index 2513cd04cfb..26843b4bc8d 100644 --- a/config/routes/import.rb +++ b/config/routes/import.rb @@ -19,10 +19,13 @@ namespace :import do resource :github, only: [:create, :new], controller: :github do post :personal_access_token get :status + get :details get :callback get :realtime_changes + get :failures post :cancel post :cancel_all + get :counts end resource :gitea, only: [:create, :new], controller: :gitea do @@ -31,12 +34,6 @@ namespace :import do get :realtime_changes end - resource :gitlab, only: [:create], controller: :gitlab do - get :status - get :callback - get :realtime_changes - end - resource :bitbucket, only: [:create], controller: :bitbucket do get :status get :callback @@ -84,6 +81,4 @@ namespace :import do get :realtime_changes post :upload end - - resource :phabricator, only: [:create, :new], controller: :phabricator end diff --git a/config/routes/issues.rb b/config/routes/issues.rb index 25e59022272..13fdde5841b 100644 --- a/config/routes/issues.rb +++ b/config/routes/issues.rb @@ -14,6 +14,10 @@ resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do post :create_merge_request get :discussions, format: :json get '/designs(/*vueroute)', to: 'issues#designs', as: :designs, format: false + get '/:incident_tab', + action: :show, + as: :incident_issue, + constraints: { incident_tab: /timeline|metrics|alerts/ } end collection do @@ -23,9 +27,10 @@ resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do post :export_csv scope :incident do - get '/:id', + get '/:id(/:incident_tab)', to: 'incidents#show', - as: :incident + as: :incident, + constraints: { incident_tab: /timeline|metrics|alerts/ } end end diff --git a/config/routes/jira_connect.rb b/config/routes/jira_connect.rb index f45f524935a..91f2a313c4e 100644 --- a/config/routes/jira_connect.rb +++ b/config/routes/jira_connect.rb @@ -5,7 +5,6 @@ namespace :jira_connect do root to: proc { [404, {}, ['']] }, as: 'base' get 'app_descriptor' => 'app_descriptor#show' - get :users, to: 'users#show' namespace :events do post 'installed' diff --git a/config/routes/pipelines.rb b/config/routes/pipelines.rb index ef390d7988b..10e0e948c62 100644 --- a/config/routes/pipelines.rb +++ b/config/routes/pipelines.rb @@ -7,7 +7,6 @@ resources :pipelines, only: [:index, :new, :create, :show, :destroy] do scope '(*ref)', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do get :latest, action: :show, defaults: { latest: true } end - get :config_variables end member do diff --git a/config/routes/profile.rb b/config/routes/profile.rb index bee1a0f108e..f42f6a9037d 100644 --- a/config/routes/profile.rb +++ b/config/routes/profile.rb @@ -22,11 +22,13 @@ resource :profile, only: [:show, :update] do end resource :notifications, only: [:show, :update] do - scope(path: 'groups/*id', - id: Gitlab::PathRegex.full_namespace_route_regex, - as: :group, - controller: :groups, - constraints: { format: /(html|json)/ }) do + scope( + path: 'groups/*id', + id: Gitlab::PathRegex.full_namespace_route_regex, + as: :group, + controller: :groups, + constraints: { format: /(html|json)/ } + ) do patch '/', action: :update put '/', action: :update end @@ -39,7 +41,7 @@ resource :profile, only: [:show, :update] do end resource :preferences, only: [:show, :update] - resources :saved_replies, only: [:index], action: :index + resources :comment_templates, only: [:index, :show], action: :index resources :keys, only: [:index, :show, :create, :destroy] do member do @@ -75,14 +77,12 @@ resource :profile, only: [:show, :update] do resource :two_factor_auth, only: [:show, :create, :destroy] do member do - post :create_u2f post :codes patch :skip post :create_webauthn end end - resources :u2f_registrations, only: [:destroy] resources :webauthn_registrations, only: [:destroy] end end diff --git a/config/routes/project.rb b/config/routes/project.rb index cf19111b2e2..995c9879aa3 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -14,22 +14,25 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # `: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 - scope(path: ':project_id', - constraints: { project_id: Gitlab::PathRegex.project_route_regex }, - module: :projects, - as: :project) do + scope( + path: '*namespace_id', + as: :namespace, + namespace_id: Gitlab::PathRegex.full_namespace_route_regex + ) do + scope( + path: ':project_id', + constraints: { project_id: Gitlab::PathRegex.project_route_regex }, + module: :projects, + as: :project + ) do # Begin of the /-/ scope. # Use this scope for all new project routes. scope '-' do - get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' - # Since the page parameter can contain slashes (panel/new), use Rails' - # "Route Globbing" syntax (/*page) so that the route helpers do not encode - # the slash character. - get 'metrics(/:dashboard_path)(/*page)', constraints: { dashboard_path: /.+\.yml/, page: 'panel/new' }, - to: 'metrics_dashboard#show', as: :metrics_dashboard, format: false + get 'archive/*id', format: true, constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' + get 'metrics(/:dashboard_path)', constraints: { dashboard_path: /.+\.yml/ }, + to: 'metrics_dashboard#show', as: :metrics_dashboard, format: false + get 'metrics(/:dashboard_path)/panel/new', constraints: { dashboard_path: /.+\.yml/ }, + to: 'metrics_dashboard#show', as: :new_metrics_dashboard, format: false namespace :metrics, module: :metrics do namespace :dashboards do @@ -101,8 +104,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :runners, only: [:index, :edit, :update, :destroy, :show] do + resources :runners, only: [:index, :new, :edit, :update, :destroy, :show] do member do + get :register post :resume post :pause end @@ -311,6 +315,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :databases, only: [:index, :create, :new], path_names: { new: 'new/:product' } end + namespace :aws do + get '/', to: redirect('%{namespace_id}/%{project_id}/-/aws/configuration') + + get '/configuration', to: 'configuration#index' + end + resources :environments, except: [:destroy] do member do post :stop @@ -361,6 +371,13 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do get 'work_items/*work_items_path' => 'work_items#index', as: :work_items get 'work_items/*work_items_path' => 'work_items#index', as: :work_item + resources :work_items, only: [] do + collection do + post :import_csv + post 'import_csv/authorize', to: 'work_items#authorize' + end + end + post 'incidents/integrations/pagerduty', to: 'incident_management/pager_duty_incidents#create' resources :incidents, only: [:index] @@ -470,12 +487,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end namespace :ml do - resources :experiments, only: [:index, :show], controller: 'experiments' - resources :candidates, only: [:show], controller: 'candidates', param: :iid - end - - namespace :airflow do - resources :dags, only: [:index, :show], controller: 'dags' + resources :experiments, only: [:index, :show, :destroy], controller: 'experiments', param: :iid + resources :candidates, only: [:show, :destroy], controller: 'candidates', param: :iid end end # End of the /-/ scope. @@ -493,20 +506,20 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # Templates # get '/templates/:template_type' => 'templates#index', # rubocop:todo Cop/PutProjectRoutesUnderScope - as: :templates, - defaults: { format: 'json' }, - constraints: { template_type: %r{issue|merge_request}, format: 'json' } + as: :templates, + defaults: { format: 'json' }, + constraints: { template_type: %r{issue|merge_request}, format: 'json' } get '/templates/:template_type/:key' => 'templates#show', # rubocop:todo Cop/PutProjectRoutesUnderScope - as: :template, - defaults: { format: 'json' }, - constraints: { key: %r{[^/]+}, template_type: %r{issue|merge_request}, format: 'json' } + as: :template, + defaults: { format: 'json' }, + constraints: { key: %r{[^/]+}, template_type: %r{issue|merge_request}, format: 'json' } get '/description_templates/names/:template_type', # rubocop:todo Cop/PutProjectRoutesUnderScope - to: 'templates#names', - as: :template_names, - defaults: { format: 'json' }, - constraints: { template_type: %r{issue|merge_request}, format: 'json' } + to: 'templates#names', + as: :template_names, + defaults: { format: 'json' }, + constraints: { template_type: %r{issue|merge_request}, format: 'json' } resource :pages, only: [:new, :show, :update, :destroy] do # rubocop: disable Cop/PutProjectRoutesUnderScope resources :domains, except: :index, controller: 'pages_domains', constraints: { id: %r{[^/]+} } do # rubocop: disable Cop/PutProjectRoutesUnderScope @@ -534,14 +547,14 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do post 'alerts/notify', to: 'alerting/notifications#create' # rubocop:todo Cop/PutProjectRoutesUnderScope post 'alerts/notify/:name/:endpoint_identifier', # rubocop:todo Cop/PutProjectRoutesUnderScope - to: 'alerting/notifications#create', - as: :alert_http_integration, - constraints: { endpoint_identifier: /[A-Za-z0-9]+/ } + to: 'alerting/notifications#create', + as: :alert_http_integration, + constraints: { endpoint_identifier: /[A-Za-z0-9]+/ } draw :legacy_builds resources :container_registry, only: [:index, :destroy, :show], # rubocop: disable Cop/PutProjectRoutesUnderScope - controller: 'registry/repositories' + controller: 'registry/repositories' namespace :registry do resources :repository, only: [] do # rubocop: disable Cop/PutProjectRoutesUnderScope @@ -550,7 +563,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # in JSON format, or a request for tag named `latest.json`. scope format: false do resources :tags, only: [:index, :destroy], # rubocop: disable Cop/PutProjectRoutesUnderScope - constraints: { id: Gitlab::Regex.container_registry_tag_regex } do + constraints: { id: Gitlab::Regex.container_registry_tag_regex } do collection do delete :bulk_destroy # rubocop:todo Cop/PutProjectRoutesUnderScope end @@ -619,26 +632,15 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do constraints: { id: /\d+/ } # rubocop: enable Cop/PutProjectRoutesUnderScope end - - # All new routes should go under /-/ scope. - # Look for scope '-' at the top of the file. - - # Legacy routes. - # Introduced in 12.0. - # Should be removed with https://gitlab.com/gitlab-org/gitlab/issues/28848. - Gitlab::Routing.redirect_legacy_paths(self, :mirror, :tags, :hooks, - :commits, :commit, :find_file, :files, :compare, - :cycle_analytics, :mattermost, :variables, :triggers, - :environments, :protected_environments, :error_tracking, :alert_management, - :serverless, :clusters, :audit_events, :wikis, :merge_requests, - :vulnerability_feedback, :security, :dependencies, :issues, - :pipelines, :pipeline_schedules, :runners, :snippets) end + # rubocop: disable Cop/PutProjectRoutesUnderScope - resources(:projects, - path: '/', - constraints: { id: Gitlab::PathRegex.project_route_regex }, - only: [:edit, :show, :update, :destroy]) do + resources( + :projects, + path: '/', + constraints: { id: Gitlab::PathRegex.project_route_regex }, + only: [:edit, :show, :update, :destroy] + ) do member do put :transfer delete :remove_fork @@ -665,8 +667,8 @@ end # rubocop: disable Cop/PutProjectRoutesUnderScope scope path: '(/-/jira)', constraints: ::Constraints::JiraEncodedUrlConstrainer.new, as: :jira do scope path: '*namespace_id/:project_id', - namespace_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX, - project_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX do + namespace_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX, + project_id: Gitlab::Jira::Dvcs::ENCODED_ROUTE_REGEX do get '/', to: redirect { |params, req| ::Gitlab::Jira::Dvcs.restore_full_path( namespace: params[:namespace_id], diff --git a/config/routes/repository.rb b/config/routes/repository.rb index 0202eb80b23..08aa113685a 100644 --- a/config/routes/repository.rb +++ b/config/routes/repository.rb @@ -75,6 +75,8 @@ scope format: false do get '/tree/*id', to: 'tree#show', as: :tree get '/raw/*id', to: 'raw#show', as: :raw + get '/blame_page/*id', to: 'blame#page', as: :blame_page + get '/blame/*id/streaming', to: 'blame#streaming', as: :blame_streaming, defaults: { streaming: true } get '/blame/*id', to: 'blame#show', as: :blame get '/commits', to: 'commits#commits_root', as: :commits_root diff --git a/config/routes/repository_deprecated.rb b/config/routes/repository_deprecated.rb index 32682000941..00206592fc8 100644 --- a/config/routes/repository_deprecated.rb +++ b/config/routes/repository_deprecated.rb @@ -10,21 +10,6 @@ resource :repository, only: [:create] # Don't use format parameter as file extension (old 3.0.x behavior) # See http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments scope format: false do - get '/refs/switch', - to: redirect('%{namespace_id}/%{project_id}/-/refs/switch') - - get '/refs/:id/logs_tree', - to: redirect('%{namespace_id}/%{project_id}/-/refs/%{id}/logs_tree'), - constraints: { id: Gitlab::PathRegex.git_reference_regex } - - get '/refs/:id/logs_tree/*path', - constraints: { id: /.*/, path: /[^\0]*/ }, - to: redirect { |params, _request| - path = params[:path] - path.gsub!('@', '-/') - Addressable::URI.escape("#{params[:namespace_id]}/#{params[:project_id]}/-/refs/#{params[:id]}/logs_tree/#{path}") - } - scope constraints: { id: /[^\0]+/ } do # Deprecated. Keep for compatibility. # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/118849 @@ -32,9 +17,5 @@ scope format: false do get '/blob/*id', to: 'blob#show', as: :deprecated_blob get '/raw/*id', to: 'raw#show', as: :deprecated_raw get '/blame/*id', to: 'blame#show', as: :deprecated_blame - - # Redirect those explicitly since `redirect_legacy_paths` conflicts with project new/edit actions - get '/new/*id', to: redirect('%{namespace_id}/%{project_id}/-/new/%{id}') - get '/edit/*id', to: redirect('%{namespace_id}/%{project_id}/-/edit/%{id}') end end diff --git a/config/routes/snippets.rb b/config/routes/snippets.rb index 5c162d0c37f..4b76ebd5ea5 100644 --- a/config/routes/snippets.rb +++ b/config/routes/snippets.rb @@ -26,4 +26,4 @@ get '/snippets/:snippet_id/raw/:ref/*path', constraints: { snippet_id: /\d+/ } get '/s/:username', to: redirect('users/%{username}/snippets'), - constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } + constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } diff --git a/config/routes/unmatched_project.rb b/config/routes/unmatched_project.rb index 3f94af33e18..c310ae91777 100644 --- a/config/routes/unmatched_project.rb +++ b/config/routes/unmatched_project.rb @@ -1,11 +1,15 @@ # frozen_string_literal: true -scope(path: '*namespace_id', - as: :namespace, - namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do - scope(path: ':project_id', - constraints: { project_id: Gitlab::PathRegex.project_route_regex }, - as: :project) do +scope( + path: '*namespace_id', + as: :namespace, + namespace_id: Gitlab::PathRegex.full_namespace_route_regex +) do + scope( + path: ':project_id', + constraints: { project_id: Gitlab::PathRegex.project_route_regex }, + as: :project + ) do post '*all', to: 'application#route_not_found' put '*all', to: 'application#route_not_found' patch '*all', to: 'application#route_not_found' diff --git a/config/routes/uploads.rb b/config/routes/uploads.rb index 52c67a705dc..4108d4675a5 100644 --- a/config/routes/uploads.rb +++ b/config/routes/uploads.rb @@ -3,8 +3,8 @@ scope path: :uploads do # Note attachments and User/Group/Project/Topic avatars get "-/system/:model/:mounted_as/:id/:filename", - to: "uploads#show", - constraints: { model: %r{note|user|group|project|projects\/topic|achievements\/achievement}, mounted_as: /avatar|attachment/, filename: %r{[^/]+} } + to: "uploads#show", + constraints: { model: %r{note|user|group|project|projects\/topic|achievements\/achievement}, mounted_as: /avatar|attachment/, filename: %r{[^/]+} } # show uploads for models, snippets (notes) available for now get '-/system/:model/:id/:secret/:filename', @@ -18,9 +18,9 @@ scope path: :uploads do # Appearance get "-/system/:model/:mounted_as/:id/:filename", - to: "uploads#show", - constraints: { model: /appearance/, mounted_as: /logo|header_logo|pwa_icon|favicon/, filename: /.+/ }, - as: 'appearance_upload' + to: "uploads#show", + constraints: { model: /appearance/, mounted_as: /logo|header_logo|pwa_icon|favicon/, filename: /.+/ }, + as: 'appearance_upload' # create uploads for models, snippets (notes) available for now post ':model', @@ -34,9 +34,15 @@ scope path: :uploads do # Alert Metric Images get "-/system/:model/:mounted_as/:id/:filename", - to: "uploads#show", - constraints: { model: /alert_management_metric_image/, mounted_as: /file/, filename: %r{[^/]+} }, - as: 'alert_metric_image_upload' + to: "uploads#show", + constraints: { model: /alert_management_metric_image/, mounted_as: /file/, filename: %r{[^/]+} }, + as: 'alert_metric_image_upload' + + # Abuse Reports Images + get "-/system/:model/:mounted_as/:id/:filename", + to: "uploads#show", + constraints: { model: /abuse_report/, mounted_as: /screenshot/, filename: %r{[^/]+} }, + as: 'abuse_report_upload' end # Redirect old note attachments path to new uploads path. diff --git a/config/routes/user.rb b/config/routes/user.rb index 1c122ea0c94..5723421cad2 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -82,12 +82,12 @@ scope '-/users', module: :users do resources :callouts, only: [:create] resources :group_callouts, only: [:create] resources :project_callouts, only: [:create] + + resource :pins, only: [:update] end scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) do - scope(path: 'users/:username', - as: :user, - controller: :users) do + scope(path: 'users/:username', as: :user, controller: :users) do get :calendar get :calendar_activities get :groups @@ -112,10 +112,12 @@ constraints(::Constraints::UserUrlConstrainer.new) do # Get all GPG keys of user get ':username.gpg' => 'users#gpg_keys', as: 'user_gpg_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 + scope( + path: ':username', + as: :user, + constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }, + controller: :users + ) do get '/', action: :show end end |