fix duplicate teams being returned by GetTeamsWithAccessToGroup

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧
2026-04-02 20:00:48 -04:00
parent 7f3e776867
commit eaee8f07b1
+2 -2
View File
@@ -11,8 +11,8 @@ import (
func GetTeamsWithAccessToGroup(ctx context.Context, orgID, groupID int64, mode perm.AccessMode) ([]*Team, error) {
teams := make([]*Team, 0)
inCond := group_model.ParentGroupCond("group_team.group_id", groupID)
return teams, db.GetEngine(ctx).Where("group_team.access_mode >= ?", mode).
Join("INNER", "group_team", "group_team.team_id = team.id").
return teams, db.GetEngine(ctx).Distinct("team.*").Where("group_team.access_mode >= ?", mode).
Join("INNER", "group_team", "group_team.team_id = team.id and group_team.org_id = ?", orgID).
And("group_team.org_id = ?", orgID).
And(inCond).
OrderBy("name").