Please the Hound

This commit is contained in:
Luka Murn 2017-02-13 14:20:44 +01:00
parent 3313d14316
commit 86be639a7c

View file

@ -254,7 +254,7 @@ class User < ActiveRecord::Base
query = Project.all.joins(:user_projects)
sql = 'projects.team_id IN (SELECT DISTINCT team_id ' \
'FROM user_teams WHERE user_teams.user_id = :user_id)'
if team_id == 0 || !user_teams.find_by(team_id: team_id).try(:admin?)
if team_id.zero? || !user_teams.find_by(team_id: team_id).try(:admin?)
# Admins see all projects of team
sql += ' AND (projects.visibility=1 OR user_projects.user_id=:user_id)'
end