Merge branch 'backort_routes_group_routes_from_ee' into 'master'
Backport EE changes to group routes Closes gitlab-ee#3794 See merge request gitlab-org/gitlab-ce!14973
This commit is contained in:
commit
a441e7a74f
|
@ -4,6 +4,18 @@ resources :groups, only: [:index, :new, :create] do
|
||||||
post :preview_markdown
|
post :preview_markdown
|
||||||
end
|
end
|
||||||
|
|
||||||
|
constraints(GroupUrlConstrainer.new) do
|
||||||
|
scope(path: 'groups/*id',
|
||||||
|
controller: :groups,
|
||||||
|
constraints: { id: Gitlab::PathRegex.full_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
|
||||||
|
get :projects, as: :projects_group
|
||||||
|
get :activity, as: :activity_group
|
||||||
|
get '/', action: :show, as: :group_canonical
|
||||||
|
end
|
||||||
|
|
||||||
scope(path: 'groups/*group_id',
|
scope(path: 'groups/*group_id',
|
||||||
module: :groups,
|
module: :groups,
|
||||||
as: :group,
|
as: :group,
|
||||||
|
@ -37,18 +49,6 @@ scope(path: 'groups/*group_id',
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scope(path: 'groups/*id',
|
|
||||||
controller: :groups,
|
|
||||||
constraints: { id: Gitlab::PathRegex.full_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
|
|
||||||
get :projects, as: :projects_group
|
|
||||||
get :activity, as: :activity_group
|
|
||||||
get '/', action: :show, as: :group_canonical
|
|
||||||
end
|
|
||||||
|
|
||||||
constraints(GroupUrlConstrainer.new) do
|
|
||||||
scope(path: '*id',
|
scope(path: '*id',
|
||||||
as: :group,
|
as: :group,
|
||||||
constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ },
|
constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ },
|
||||||
|
|
|
@ -285,17 +285,15 @@ end
|
||||||
|
|
||||||
describe "Groups", "routing" do
|
describe "Groups", "routing" do
|
||||||
let(:name) { 'complex.group-namegit' }
|
let(:name) { 'complex.group-namegit' }
|
||||||
|
let!(:group) { create(:group, name: name) }
|
||||||
before do
|
|
||||||
allow_any_instance_of(GroupUrlConstrainer).to receive(:matches?).and_return(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "to #show" do
|
it "to #show" do
|
||||||
expect(get("/groups/#{name}")).to route_to('groups#show', id: name)
|
expect(get("/groups/#{name}")).to route_to('groups#show', id: name)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "also supports nested groups" do
|
it "also supports nested groups" do
|
||||||
expect(get("/#{name}/#{name}")).to route_to('groups#show', id: "#{name}/#{name}")
|
nested_group = create(:group, parent: group)
|
||||||
|
expect(get("/#{name}/#{nested_group.name}")).to route_to('groups#show', id: "#{name}/#{nested_group.name}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "also display group#show on the short path" do
|
it "also display group#show on the short path" do
|
||||||
|
@ -313,10 +311,6 @@ describe "Groups", "routing" do
|
||||||
it "to #members" do
|
it "to #members" do
|
||||||
expect(get("/groups/#{name}/group_members")).to route_to('groups/group_members#index', group_id: name)
|
expect(get("/groups/#{name}/group_members")).to route_to('groups/group_members#index', group_id: name)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "also display group#show with slash in the path" do
|
|
||||||
expect(get('/group/subgroup')).to route_to('groups#show', id: 'group/subgroup')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe HealthCheckController, 'routing' do
|
describe HealthCheckController, 'routing' do
|
||||||
|
|
Loading…
Reference in New Issue