Commit 72b295259ed8565e166a7f2a466ca33d183f6108
1 parent
d54d3324
Exists in
spb-stable
and in
2 other branches
Show only personal projects on profile page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
6 additions
and
3 deletions
Show diff stats
app/controllers/users_controller.rb
| @@ -4,10 +4,12 @@ class UsersController < ApplicationController | @@ -4,10 +4,12 @@ class UsersController < ApplicationController | ||
| 4 | 4 | ||
| 5 | def show | 5 | def show |
| 6 | @user = User.find_by_username!(params[:username]) | 6 | @user = User.find_by_username!(params[:username]) |
| 7 | - @projects = @user.authorized_projects.accessible_to(current_user) | 7 | + @projects = Project.personal(@user).accessible_to(current_user) |
| 8 | + | ||
| 8 | if !current_user && @projects.empty? | 9 | if !current_user && @projects.empty? |
| 9 | return authenticate_user! | 10 | return authenticate_user! |
| 10 | end | 11 | end |
| 12 | + | ||
| 11 | @groups = @user.groups.accessible_to(current_user) | 13 | @groups = @user.groups.accessible_to(current_user) |
| 12 | @events = @user.recent_events.where(project_id: @projects.pluck(:id)).limit(20) | 14 | @events = @user.recent_events.where(project_id: @projects.pluck(:id)).limit(20) |
| 13 | @title = @user.name | 15 | @title = @user.name |
app/views/users/_projects.html.haml
app/views/users/show.html.haml