A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

clear old handles from db if migrated to new did

+18
+18
pkg/appview/db/queries.go
··· 373 373 // InsertUserIfNotExists inserts a user record only if it doesn't already exist. 374 374 // Used by non-profile collections to avoid unnecessary writes during backfill. 375 375 func InsertUserIfNotExists(db DBTX, user *User) error { 376 + // Clear handle from any other DID that currently holds it. 377 + // In ATProto, a handle belongs to exactly one DID at a time — 378 + // if a new DID claims this handle, the old association is stale. 379 + _, _ = db.Exec(`UPDATE users SET handle = did WHERE handle = ? AND did != ?`, 380 + user.Handle, user.DID) 381 + 376 382 _, err := db.Exec(` 377 383 INSERT INTO users (did, handle, pds_endpoint, avatar, last_seen) 378 384 VALUES (?, ?, ?, ?, ?) ··· 383 389 384 390 // UpsertUser inserts or updates a user record 385 391 func UpsertUser(db DBTX, user *User) error { 392 + // Clear handle from any other DID that currently holds it. 393 + // In ATProto, a handle belongs to exactly one DID at a time — 394 + // if a new DID claims this handle, the old association is stale. 395 + _, _ = db.Exec(`UPDATE users SET handle = did WHERE handle = ? AND did != ?`, 396 + user.Handle, user.DID) 397 + 386 398 _, err := db.Exec(` 387 399 INSERT INTO users (did, handle, pds_endpoint, avatar, last_seen) 388 400 VALUES (?, ?, ?, ?, ?) ··· 398 410 // UpsertUserIgnoreAvatar inserts or updates a user record, but preserves existing avatar on update 399 411 // This is useful when avatar fetch fails, and we don't want to overwrite an existing avatar with empty string 400 412 func UpsertUserIgnoreAvatar(db DBTX, user *User) error { 413 + // Clear handle from any other DID that currently holds it. 414 + // In ATProto, a handle belongs to exactly one DID at a time — 415 + // if a new DID claims this handle, the old association is stale. 416 + _, _ = db.Exec(`UPDATE users SET handle = did WHERE handle = ? AND did != ?`, 417 + user.Handle, user.DID) 418 + 401 419 _, err := db.Exec(` 402 420 INSERT INTO users (did, handle, pds_endpoint, avatar, last_seen) 403 421 VALUES (?, ?, ?, ?, ?)