mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-15 23:40:58 +02:00
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
This commit is contained in:
parent
635b5f5b33
commit
3b39ce1f47
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user