0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-04 14:36:16 +02:00

[services] ensure OwnerName field is updated in groups owned by an org when its name is updated

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-01-09 19:36:20 -05:00
parent 4ef0a905de
commit e7fa8649c4
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C

View File

@ -4,6 +4,7 @@
package user
import (
group_model "code.gitea.io/gitea/models/group"
"context"
"fmt"
"os"
@ -78,6 +79,10 @@ func RenameUser(ctx context.Context, u *user_model.User, newUserName string, doe
return err
}
if err = group_model.UpdateGroupOwnerName(ctx, oldUserName, newUserName); err != nil {
return err
}
if err = user_model.NewUserRedirect(ctx, u.ID, oldUserName, newUserName); err != nil {
return err
}