Commit 8249fcf5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Move some project routes under - scope

Affected project routes are:

* services
* boards
* releases
* forks
* group_links
* import
* avatar
* labels
* milestones
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 65d65fed
......@@ -124,6 +124,44 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
put :revoke
end
end
resources :milestones, constraints: { id: /\d+/ } do
member do
post :promote
put :sort_issues
put :sort_merge_requests
get :merge_requests
get :participants
get :labels
end
end
resources :labels, except: [:show], constraints: { id: /\d+/ } do
collection do
post :generate
post :set_priorities
end
member do
post :promote
post :toggle_subscription
delete :remove_priority
end
end
resources :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
member do
put :test
end
end
resources :boards, only: [:index, :show], constraints: { id: /\d+/ }
resources :releases, only: [:index]
resources :forks, only: [:index, :new, :create]
resources :group_links, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ }
resource :import, only: [:new, :create, :show]
resource :avatar, only: [:show, :destroy]
end
# End of the /-/ scope.
......@@ -132,7 +170,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
#
get '/templates/:template_type/:key' => 'templates#show', as: :template, constraints: { key: %r{[^/]+} }
resource :avatar, only: [:show, :destroy]
resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do
member do
get :branches
......@@ -159,12 +196,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
member do
put :test
end
end
resource :mattermost, only: [:new, :create]
namespace :prometheus do
......@@ -173,10 +204,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :releases, only: [:index]
resources :forks, only: [:index, :new, :create]
resource :import, only: [:new, :create, :show]
resources :merge_requests, concerns: :awardable, except: [:new, :create], constraints: { id: /\d+/ } do
member do
get :commit_change_content
......@@ -372,31 +399,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :milestones, constraints: { id: /\d+/ } do
member do
post :promote
put :sort_issues
put :sort_merge_requests
get :merge_requests
get :participants
get :labels
end
end
resources :labels, except: [:show], constraints: { id: /\d+/ } do
collection do
post :generate
post :set_priorities
end
member do
post :promote
post :toggle_subscription
delete :remove_priority
end
end
get :issues, to: 'issues#calendar', constraints: lambda { |req| req.format == :ics }
resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do
member do
post :toggle_subscription
......@@ -408,14 +412,13 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post :create_merge_request
get :discussions, format: :json
end
collection do
post :bulk_update
post :import_csv
end
end
resources :group_links, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ }
resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do
member do
delete :delete_attachment
......@@ -426,8 +429,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get 'noteable/:target_type/:target_id/notes' => 'notes#index', as: 'noteable_notes'
resources :boards, only: [:index, :show], constraints: { id: /\d+/ }
resources :todos, only: [:create]
resources :uploads, only: [:create] do
......@@ -510,7 +511,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
as: :project) do
Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags,
:network, :graphs, :autocomplete_sources,
:project_members, :deploy_keys, :deploy_tokens)
:project_members, :deploy_keys, :deploy_tokens,
:labels, :milestones, :services, :boards, :releases,
:forks, :group_links, :import, :avatar)
end
end
end
......@@ -470,18 +470,23 @@ describe 'project routing' do
it_behaves_like 'RESTful project resources' do
let(:controller) { 'milestones' }
let(:actions) { [:index, :create, :new, :edit, :show, :update] }
let(:controller_path) { '/-/milestones' }
end
it 'to #promote' do
expect(post('/gitlab/gitlabhq/milestones/1/promote')).to route_to('projects/milestones#promote', namespace_id: 'gitlab', project_id: 'gitlabhq', id: "1")
expect(post('/gitlab/gitlabhq/-/milestones/1/promote')).to route_to('projects/milestones#promote', namespace_id: 'gitlab', project_id: 'gitlabhq', id: "1")
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/milestones", "/gitlab/gitlabhq/-/milestones"
end
# project_labels GET /:project_id/labels(.:format) labels#index
describe Projects::LabelsController, 'routing' do
it 'to #index' do
expect(get('/gitlab/gitlabhq/labels')).to route_to('projects/labels#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
expect(get('/gitlab/gitlabhq/-/labels')).to route_to('projects/labels#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/labels", "/gitlab/gitlabhq/-/labels"
end
# sort_project_issues POST /:project_id/issues/sort(.:format) issues#sort
......@@ -623,20 +628,24 @@ describe 'project routing' do
describe Projects::ForksController, 'routing' do
it 'to #new' do
expect(get('/gitlab/gitlabhq/forks/new')).to route_to('projects/forks#new', namespace_id: 'gitlab', project_id: 'gitlabhq')
expect(get('/gitlab/gitlabhq/-/forks/new')).to route_to('projects/forks#new', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it 'to #create' do
expect(post('/gitlab/gitlabhq/forks')).to route_to('projects/forks#create', namespace_id: 'gitlab', project_id: 'gitlabhq')
expect(post('/gitlab/gitlabhq/-/forks')).to route_to('projects/forks#create', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/forks", "/gitlab/gitlabhq/-/forks"
end
# project_avatar DELETE /project/avatar(.:format) projects/avatars#destroy
describe Projects::AvatarsController, 'routing' do
it 'to #destroy' do
expect(delete('/gitlab/gitlabhq/avatar')).to route_to(
expect(delete('/gitlab/gitlabhq/-/avatar')).to route_to(
'projects/avatars#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/avatar", "/gitlab/gitlabhq/-/avatar"
end
describe Projects::PagesDomainsController, 'routing' do
......
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