diff options
author | Adam Niedzielski <adamsunday@gmail.com> | 2016-10-21 11:08:33 +0200 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2016-10-21 11:08:33 +0200 |
commit | 56dcc5f1637e7e2b50faf4f955d7ab6eb0f63cdd (patch) | |
tree | 732f6eb7f03939d456cb60f8f21b0f6eeafb9a5c | |
parent | 9df2115a4df5a964774128fdbbe1b3e695105536 (diff) | |
download | gitlab-ce-adam-fix-group-web-url.tar.gz |
Change "Group#web_url" to return "/groups/twitter" rather than "/twitter".adam-fix-group-web-url
Bring back the old behaviour which was changed by 6b90ccb9.
Fixes #23527.
-rw-r--r-- | app/models/group.rb | 2 | ||||
-rw-r--r-- | config/routes/group.rb | 1 | ||||
-rw-r--r-- | spec/models/group_spec.rb | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 00a595d2705..6865e610718 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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 diff --git a/config/routes/group.rb b/config/routes/group.rb index 4838c9d91c6..6e081252200 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -13,6 +13,7 @@ constraints(GroupUrlConstrainer.new) do end resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do + get '/', action: :show, as: :canonical member do get :issues get :merge_requests diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index ac862055ebc..47f89f744cb 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -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 |