Commit c81ff152 authored by Adam Niedzielski's avatar Adam Niedzielski

Change "Group#web_url" to return "/groups/twitter" rather than "/twitter".

Bring back the old behaviour which was changed by 6b90ccb9.
Fixes #23527.
parent 9df2115a
......@@ -68,7 +68,7 @@ class Group < Namespace
end
def web_url
Gitlab::Routing.url_helpers.group_url(self)
Gitlab::Routing.url_helpers.group_canonical_url(self)
end
def human_name
......
......@@ -12,7 +12,8 @@ constraints(GroupUrlConstrainer.new) do
end
end
resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do
scope constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do
resources :groups, except: [:show] do
member do
get :issues
get :merge_requests
......@@ -31,4 +32,6 @@ resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do
resources :labels, except: [:show], constraints: { id: /\d+/ }
end
end
get 'groups/:id' => 'groups#show', as: :group_canonical
end
......@@ -265,4 +265,10 @@ describe Group, models: true do
members
end
describe '#web_url' do
it 'returns the canonical URL' do
expect(group.web_url).to include("groups/#{group.name}")
end
end
end
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