Commit bcea7ba331e26c037dda9782f069bfb38f5bb602
Exists in
spb-stable
and in
2 other branches
Merge branch 'namespace-route' into 'master'
Namespace route Fixes #1312
Showing
2 changed files
with
19 additions
and
1 deletions
Show diff stats
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +class NamespacesController < ApplicationController | ||
2 | + skip_before_filter :authenticate_user! | ||
3 | + | ||
4 | + def show | ||
5 | + namespace = Namespace.find_by(path: params[:id]) | ||
6 | + | ||
7 | + unless namespace | ||
8 | + return render_404 | ||
9 | + end | ||
10 | + | ||
11 | + if namespace.type == "Group" | ||
12 | + redirect_to group_path(namespace) | ||
13 | + else | ||
14 | + redirect_to user_path(namespace.owner) | ||
15 | + end | ||
16 | + end | ||
17 | +end | ||
18 | + |
config/routes.rb
@@ -315,7 +315,7 @@ Gitlab::Application.routes.draw do | @@ -315,7 +315,7 @@ Gitlab::Application.routes.draw do | ||
315 | end | 315 | end |
316 | end | 316 | end |
317 | 317 | ||
318 | - get ':id' => "groups#show", constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} | 318 | + get ':id' => "namespaces#show", constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} |
319 | 319 | ||
320 | root to: "dashboard#show" | 320 | root to: "dashboard#show" |
321 | end | 321 | end |