Skip to content

Commit 7bb645e

Browse files
committed
not needed here and dublicated on related pull
1 parent 12bd60b commit 7bb645e

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

models/organization/org.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -658,19 +658,12 @@ func (org *Organization) getUserTeamIDs(ctx context.Context, userID int64) ([]in
658658
return teamIDs, db.GetEngine(ctx).
659659
Table("team").
660660
Cols("team.id").
661-
Where(builder.In("team.id", getUserTeamIDsQueryBuilder(org.ID, userID))).
661+
Where("`team_user`.org_id = ?", org.ID).
662+
Join("INNER", "team_user", "`team_user`.team_id = team.id").
663+
And("`team_user`.uid = ?", userID).
662664
Find(&teamIDs)
663665
}
664666

665-
func getUserTeamIDsQueryBuilder(orgID, userID int64) *builder.Builder {
666-
return builder.Select("team.id").From("team").
667-
InnerJoin("team_user", "team_user.team_id = team.id").
668-
Where(builder.Eq{
669-
"team_user.org_id": orgID,
670-
"team_user.uid": userID,
671-
})
672-
}
673-
674667
// TeamsWithAccessToRepo returns all teams that have given access level to the repository.
675668
func (org *Organization) TeamsWithAccessToRepo(ctx context.Context, repoID int64, mode perm.AccessMode) ([]*Team, error) {
676669
return GetTeamsWithAccessToRepo(ctx, org.ID, repoID, mode)

0 commit comments

Comments
 (0)