0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-13 09:35:13 +02:00

fix duplicate teams being returned by GetTeamsWithAccessToGroup

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-07-19 23:09:44 -04:00
parent 7f3e776867
commit eaee8f07b1
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C

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").