From 7984e5b1efd430ce1ea1486c647f4beaa1c13e46 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Tue, 3 Jun 2014 18:09:51 +0300
Subject: [PATCH] Show events from all projects on user page

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 app/controllers/users_controller.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index d42c2db9e5..c17c6f9694 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -11,7 +11,8 @@ class UsersController < ApplicationController
     end
 
     @groups = @user.groups.accessible_to(current_user)
-    @events = @user.recent_events.where(project_id: @projects.pluck(:id)).limit(20)
+    accessible_projects = @user.authorized_projects.accessible_to(current_user)
+    @events = @user.recent_events.where(project_id: accessible_projects.pluck(:id)).limit(20)
     @title = @user.name
   end
 
-- 
2.30.9