2014-06-07 08:06:55 -04:00
|
|
|
class NamespacesController < ApplicationController
|
2015-04-16 08:03:37 -04:00
|
|
|
skip_before_action :authenticate_user!
|
2014-06-07 08:06:55 -04:00
|
|
|
|
|
|
|
def show
|
|
|
|
namespace = Namespace.find_by(path: params[:id])
|
|
|
|
|
2015-03-24 10:55:12 -04:00
|
|
|
if namespace
|
|
|
|
if namespace.is_a?(Group)
|
|
|
|
group = namespace
|
|
|
|
else
|
|
|
|
user = namespace.owner
|
|
|
|
end
|
2014-06-07 08:06:55 -04:00
|
|
|
end
|
|
|
|
|
2015-03-24 10:55:12 -04:00
|
|
|
if user
|
|
|
|
redirect_to user_path(user)
|
2015-09-14 05:16:54 -04:00
|
|
|
elsif group
|
2015-03-24 10:55:12 -04:00
|
|
|
redirect_to group_path(group)
|
|
|
|
elsif current_user.nil?
|
|
|
|
authenticate_user!
|
2014-06-07 08:06:55 -04:00
|
|
|
else
|
2015-03-24 10:55:12 -04:00
|
|
|
render_404
|
2014-06-07 08:06:55 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|