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

This reverts commit 9dbd5b3cfa.
This commit is contained in:
Dmitriy Zaporozhets 2016-10-26 21:13:58 +03:00
parent b5797168ec
commit 3be445c58e
3 changed files with 25 additions and 16 deletions

View file

@ -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

View file

@ -12,23 +12,26 @@ constraints(GroupUrlConstrainer.new) do
end
end
resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do
member do
get :issues
get :merge_requests
get :projects
get :activity
end
scope module: :groups do
resources :group_members, only: [:index, :create, :update, :destroy], concerns: :access_requestable do
post :resend_invite, on: :member
delete :leave, on: :collection
scope constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do
resources :groups, except: [:show] do
member do
get :issues
get :merge_requests
get :projects
get :activity
end
resource :avatar, only: [:destroy]
resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create]
scope module: :groups do
resources :group_members, only: [:index, :create, :update, :destroy], concerns: :access_requestable do
post :resend_invite, on: :member
delete :leave, on: :collection
end
resources :labels, except: [:show], constraints: { id: /\d+/ }
resource :avatar, only: [:destroy]
resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create]
resources :labels, except: [:show], constraints: { id: /\d+/ }
end
end
get 'groups/:id' => 'groups#show', as: :group_canonical
end

View file

@ -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