mirror of https://github.com/go-gitea/gitea.git
Fix test
This commit is contained in:
parent
c2ff613582
commit
c0edbd4d67
|
@ -255,7 +255,7 @@ func UpdateTeam(ctx context.Context, t *organization.Team, updateCols ...string)
|
|||
}
|
||||
|
||||
// update units for team
|
||||
if len(t.Units) > 0 {
|
||||
if slices.Contains(updateCols, "units") {
|
||||
for _, unit := range t.Units {
|
||||
unit.TeamID = t.ID
|
||||
}
|
||||
|
|
|
@ -320,10 +320,15 @@ func EditTeam(ctx *context.APIContext) {
|
|||
}
|
||||
}
|
||||
|
||||
isAdmin := team.AccessMode == perm.AccessModeAdmin
|
||||
if form.Permission != "" && form.Permission == "admin" {
|
||||
isAdmin = true
|
||||
}
|
||||
|
||||
if err := org_service.UpdateTeam(ctx, team, org_service.UpdateTeamOptions{
|
||||
TeamName: teamName,
|
||||
Description: description,
|
||||
IsAdmin: form.Permission == "admin",
|
||||
IsAdmin: isAdmin,
|
||||
IncludesAllRepositories: includeAllRepos,
|
||||
CanCreateOrgRepo: canCreateOrgRepo,
|
||||
UnitPerms: unitPerms,
|
||||
|
|
|
@ -25,10 +25,10 @@ type UpdateTeamOptions struct {
|
|||
func UpdateTeam(ctx context.Context, team *org_model.Team, opts UpdateTeamOptions) error {
|
||||
var changedCols []string
|
||||
|
||||
var newAccessMode perm.AccessMode
|
||||
newAccessMode := team.AccessMode
|
||||
if opts.IsAdmin {
|
||||
newAccessMode = perm.AccessModeAdmin
|
||||
} else {
|
||||
} else if len(opts.UnitPerms) > 0 {
|
||||
// if newAccessMode is less than admin accessmode, then it should be general accessmode,
|
||||
// so we should calculate the minial accessmode from units accessmodes.
|
||||
newAccessMode = unit_model.MinUnitAccessMode(opts.UnitPerms)
|
||||
|
|
Loading…
Reference in New Issue