debian-mirror-gitlab/app/controllers/namespaces_controller.rb

26 lines
489 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
class NamespacesController < ApplicationController
2015-09-11 14:41:01 +05:30
skip_before_action :authenticate_user!
2014-09-02 18:07:02 +05:30
def show
namespace = Namespace.find_by(path: params[:id])
2015-04-26 12:48:37 +05:30
if namespace
if namespace.is_a?(Group)
group = namespace
else
user = namespace.owner
end
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
if user
redirect_to user_path(user)
2015-09-25 12:07:36 +05:30
elsif group
2015-04-26 12:48:37 +05:30
redirect_to group_path(group)
elsif current_user.nil?
authenticate_user!
2014-09-02 18:07:02 +05:30
else
2015-04-26 12:48:37 +05:30
render_404
2014-09-02 18:07:02 +05:30
end
end
end