[Fix] Account Linking UpdateMigrationsByType (#31428)

Fix https://github.com/go-gitea/gitea/issues/31427
pull/31435/head^2
Sumit 5 months ago committed by GitHub
parent 90a3c20e79
commit 17b3a38577
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      services/externalaccount/user.go

@ -5,6 +5,7 @@ package externalaccount
import (
"context"
"strconv"
"strings"
"code.gitea.io/gitea/models/auth"
@ -82,6 +83,11 @@ func UpdateExternalUser(ctx context.Context, user *user_model.User, gothUser got
// UpdateMigrationsByType updates all migrated repositories' posterid from gitServiceType to replace originalAuthorID to posterID
func UpdateMigrationsByType(ctx context.Context, tp structs.GitServiceType, externalUserID string, userID int64) error {
// Skip update if externalUserID is not a valid numeric ID or exceeds int64
if _, err := strconv.ParseInt(externalUserID, 10, 64); err != nil {
return nil
}
if err := issues_model.UpdateIssuesMigrationsByType(ctx, tp, externalUserID, userID); err != nil {
return err
}

Loading…
Cancel
Save