diff options
author | Giteabot <teabot@gitea.io> | 2023-07-03 07:23:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-03 14:23:35 +0300 |
commit | 64ed262e18a4c686d86737c9779a851f52a2181c (patch) | |
tree | 610290f8ee48a7dd5d1261a3d4e73a6cf2d8f287 /models | |
parent | f51c8e0008c37644a332da990b791e299130d375 (diff) | |
download | gitea-64ed262e18a4c686d86737c9779a851f52a2181c.tar.gz gitea-64ed262e18a4c686d86737c9779a851f52a2181c.zip |
Fix bug when change user name (#25637) (#25646)
Backport #25637 by @lunny
Fix #25621
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models')
-rw-r--r-- | models/user/redirect.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/models/user/redirect.go b/models/user/redirect.go index 9d8903c059..42e991888a 100644 --- a/models/user/redirect.go +++ b/models/user/redirect.go @@ -64,6 +64,10 @@ func NewUserRedirect(ctx context.Context, ID int64, oldUserName, newUserName str oldUserName = strings.ToLower(oldUserName) newUserName = strings.ToLower(newUserName) + if err := DeleteUserRedirect(ctx, oldUserName); err != nil { + return err + } + if err := DeleteUserRedirect(ctx, newUserName); err != nil { return err } |