From 8de0e282e3783a8a73a48e1770a93c050a964a0d Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 1 Jun 2018 16:38:49 +0200 Subject: [PATCH] Fix project_tree for non admin users [SCI-2478] --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 1453a9367..58eb08a15 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -342,8 +342,8 @@ class User < ApplicationRecord result = team.projects.includes(active_experiments: :active_my_modules) unless is_admin_of_team?(team) # Only admins see all projects of the team - result = result.includes(:user_projects).where( - 'visibility = 1 OR user_projects.user_id=:user_id)', user_id: id + result = result.joins(:user_projects).where( + 'visibility=1 OR user_projects.user_id=:user_id', user_id: id ) end