gitlab-org--gitlab-foss/app/controllers/users_controller.rb
Jason Hollingsworth 2f69213e3f Allow access to groups with public projects.
Fixed Group avatars to only display when user has read
permissions to at least one project in the group.
2014-02-20 09:26:38 -06:00

23 lines
623 B
Ruby

class UsersController < ApplicationController
skip_before_filter :authenticate_user!, only: [:show]
layout :determine_layout
def show
@user = User.find_by_username!(params[:username])
@projects = @user.authorized_projects.accessible_to(current_user)
if !current_user && @projects.empty?
return authenticate_user!
end
@groups = @user.groups.accessible_to(current_user)
@events = @user.recent_events.where(project_id: @projects.pluck(:id)).limit(20)
@title = @user.name
end
def determine_layout
if current_user
'navless'
else
'public_users'
end
end
end