Skip to content

Commit 0509b91

Browse files
fix duplicate teams being returned by GetTeamsWithAccessToGroup
1 parent 6083dbc commit 0509b91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/organization/team_group.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
func GetTeamsWithAccessToGroup(ctx context.Context, orgID, groupID int64, mode perm.AccessMode) ([]*Team, error) {
1212
teams := make([]*Team, 0)
1313
inCond := group_model.ParentGroupCond("group_team.group_id", groupID)
14-
return teams, db.GetEngine(ctx).Where("group_team.access_mode >= ?", mode).
15-
Join("INNER", "group_team", "group_team.team_id = team.id").
14+
return teams, db.GetEngine(ctx).Distinct("team.*").Where("group_team.access_mode >= ?", mode).
15+
Join("INNER", "group_team", "group_team.team_id = team.id and group_team.org_id = ?", orgID).
1616
And("group_team.org_id = ?", orgID).
1717
And(inCond).
1818
OrderBy("name").

0 commit comments

Comments
 (0)