From a0f2fbc25094066995aefe7c3ad6b0f0de8e5fe3 Mon Sep 17 00:00:00 2001 From: Andrey Kumanyaev Date: Mon, 18 Mar 2013 15:44:26 +0400 Subject: [PATCH] Fix bug with downgrade permissions on first project assigment to team --- lib/gitlab/user_team_manager.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/user_team_manager.rb b/lib/gitlab/user_team_manager.rb index a8ff4a3d..e7b97563 100644 --- a/lib/gitlab/user_team_manager.rb +++ b/lib/gitlab/user_team_manager.rb @@ -88,9 +88,8 @@ module Gitlab def max_teams_member_permission_in_project(user, project, teams = nil) result_access = 0 - user_teams = project.user_teams.with_member(user) - - teams ||= user_teams + teams ||= project.user_teams.with_member(user) + result_access ||= project.users_project.with_user(user).first.project_access if teams.any? teams.each do |team|