summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/user/redirect.go4
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
}