Add users to /:id route
So now when you type site/:username it redirects you to users page. And if you type site/:groupname it redirects you to group page Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
ab094e67ee
commit
3dc0bce947
2 changed files with 19 additions and 1 deletions
18
app/controllers/namespaces_controller.rb
Normal file
18
app/controllers/namespaces_controller.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
class NamespacesController < ApplicationController
|
||||
skip_before_filter :authenticate_user!
|
||||
|
||||
def show
|
||||
namespace = Namespace.find_by(path: params[:id])
|
||||
|
||||
unless namespace
|
||||
return render_404
|
||||
end
|
||||
|
||||
if namespace.type == "Group"
|
||||
redirect_to group_path(namespace)
|
||||
else
|
||||
redirect_to user_path(namespace.owner)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -315,7 +315,7 @@ Gitlab::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
get ':id' => "groups#show", constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}
|
||||
get ':id' => "namespaces#show", constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}
|
||||
|
||||
root to: "dashboard#show"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue