From 3b39ce1f47f3002c5405ccf0af8c861a0b5d8639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Sun, 30 Nov 2025 15:46:33 -0500 Subject: [PATCH] update group team routes - ensure we redirect to the group's team page, as opposed to the org-wide one - ensure we use the group service to add a team to a group --- routers/web/group/team.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/routers/web/group/team.go b/routers/web/group/team.go index 5aed8036557..4a06d6f9b23 100644 --- a/routers/web/group/team.go +++ b/routers/web/group/team.go @@ -4,6 +4,7 @@ package group import ( + "fmt" "net/http" "strings" @@ -147,7 +148,7 @@ func EditTeamPost(ctx *context.Context) { ctx.ServerError("UpdateGroupTeam", err) return } - ctx.Redirect(ctx.Org.OrgLink + "/teams/") + ctx.Redirect(ctx.Org.OrgLink + fmt.Sprintf("/groups/%d/teams", gt.GroupID)) } func TeamAddPost(ctx *context.Context) { @@ -171,22 +172,11 @@ func TeamAddPost(ctx *context.Context) { if has { ctx.Flash.Error(ctx.Tr("org.group.add_duplicate_team")) } else { - parentGroup, err := group_model.FindGroupTeamByTeamID(ctx, group.ID, t.ID) - if err != nil { - ctx.ServerError("FindGroupTeamByTeamID", err) - return - } - mode := t.AccessMode - canCreateIn := t.CanCreateOrgRepo - if parentGroup != nil { - mode = max(t.AccessMode, parentGroup.AccessMode) - canCreateIn = parentGroup.CanCreateIn || t.CanCreateOrgRepo - } if err = group.LoadParentGroup(ctx); err != nil { ctx.ServerError("LoadParentGroup", err) return } - err = group_model.AddTeamGroup(ctx, ctx.RepoGroup.Group.OwnerID, t.ID, ctx.RepoGroup.Group.ID, mode, canCreateIn) + err = group_service.AddTeamToGroup(ctx, group, tname) if err != nil { ctx.ServerError("AddTeamGroup", err) return