mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-02 15:09:33 -05:00
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
|
// update units for team
|
||||||
if len(t.Units) > 0 {
|
if slices.Contains(updateCols, "units") {
|
||||||
for _, unit := range t.Units {
|
for _, unit := range t.Units {
|
||||||
unit.TeamID = t.ID
|
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{
|
if err := org_service.UpdateTeam(ctx, team, org_service.UpdateTeamOptions{
|
||||||
TeamName: teamName,
|
TeamName: teamName,
|
||||||
Description: description,
|
Description: description,
|
||||||
IsAdmin: form.Permission == "admin",
|
IsAdmin: isAdmin,
|
||||||
IncludesAllRepositories: includeAllRepos,
|
IncludesAllRepositories: includeAllRepos,
|
||||||
CanCreateOrgRepo: canCreateOrgRepo,
|
CanCreateOrgRepo: canCreateOrgRepo,
|
||||||
UnitPerms: unitPerms,
|
UnitPerms: unitPerms,
|
||||||
|
@ -25,10 +25,10 @@ type UpdateTeamOptions struct {
|
|||||||
func UpdateTeam(ctx context.Context, team *org_model.Team, opts UpdateTeamOptions) error {
|
func UpdateTeam(ctx context.Context, team *org_model.Team, opts UpdateTeamOptions) error {
|
||||||
var changedCols []string
|
var changedCols []string
|
||||||
|
|
||||||
var newAccessMode perm.AccessMode
|
newAccessMode := team.AccessMode
|
||||||
if opts.IsAdmin {
|
if opts.IsAdmin {
|
||||||
newAccessMode = perm.AccessModeAdmin
|
newAccessMode = perm.AccessModeAdmin
|
||||||
} else {
|
} else if len(opts.UnitPerms) > 0 {
|
||||||
// if newAccessMode is less than admin accessmode, then it should be general accessmode,
|
// if newAccessMode is less than admin accessmode, then it should be general accessmode,
|
||||||
// so we should calculate the minial accessmode from units accessmodes.
|
// so we should calculate the minial accessmode from units accessmodes.
|
||||||
newAccessMode = unit_model.MinUnitAccessMode(opts.UnitPerms)
|
newAccessMode = unit_model.MinUnitAccessMode(opts.UnitPerms)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user