diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-07 12:50:45 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-07 12:50:45 +0000 |
commit | bcea7ba331e26c037dda9782f069bfb38f5bb602 (patch) | |
tree | 53155fe90121a67c2ba00222e21f4cb1ab171939 | |
parent | 0d13abb1c8d527f2a6e6b97e34899e9b35f264bc (diff) | |
parent | 3dc0bce9474ac52046f5c3efb2532af6334a7aae (diff) | |
download | gitlab-ce-bcea7ba331e26c037dda9782f069bfb38f5bb602.tar.gz |
Merge branch 'namespace-route' into 'master'
Namespace route
Fixes #1312
-rw-r--r-- | app/controllers/namespaces_controller.rb | 18 | ||||
-rw-r--r-- | config/routes.rb | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/namespaces_controller.rb b/app/controllers/namespaces_controller.rb new file mode 100644 index 00000000000..c59a2401cef --- /dev/null +++ b/app/controllers/namespaces_controller.rb @@ -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 + diff --git a/config/routes.rb b/config/routes.rb index 7c2ab6bd1dd..67ff66757e6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 |