[Bug]: `updateProfileRecord` drops the profile's `links` on every update

Aperta Adatta ai principianti
#344 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
swift

Direzione di ricerca

Leggi UpdateProfileRecord.swift, in particolare le copie dei campi esistenti intorno alle righe 69–77 e l’inizializzatore di ProfileRecord intorno alle righe 189–200. Segui come replace seleziona i valori e come putRecord scrive il profilo. Il lavoro è completato quando l’aggiornamento di un altro campo conserva i links esistenti; esegui i test pertinenti sull’aggiornamento del profilo, se disponibili.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Summary

ATProtoBluesky.updateProfileRecord(profileURI:replace:) reads the existing profile record, rebuilds it as a new AppBskyLexicon.Actor.ProfileRecord, and writes it back with putRecord. The rebuilt record never carries over links, so any update — even one that only changes pinnedPost or labels — removes all of the profile's links (app.bsky.actor.profile#links, the ordered strongRefs to app.bsky.actor.link records).

Reproduction Steps
  1. Use an account whose app.bsky.actor.profile/self record has a non-empty links array (e.g. one set from the official Bluesky app).
  2. Call updateProfileRecord(profileURI:replace:) with any field, e.g. replace: [.pinnedPost(with: someReference)].
  3. Fetch the profile record again with getRepositoryRecord, or the profile with getProfile.
Expected Results

Fields not listed in replace are preserved, including links.

Actual Results

links is removed from the profile record, and getProfile no longer returns any links.

What operating systems did you experience this bug?

macOS

Operating System Version

macOS Golden Gate 27.2

ATProtoKit Version

0.34.1

Additional Context

The app.bsky.actor.link records themselves remain in the repo but are no longer referenced by the profile.

In UpdateProfileRecord.swift, the existing values are copied for every other field (lines 69–77), but links is not, and the ProfileRecord initializer is called without it, so it falls back to its default of nil (lines 189–200):

let profileRecord = AppBskyLexicon.Actor.ProfileRecord(
    displayName: newDisplayName,
    description: newDescription,
    pronouns: newPronouns,
    websiteURL: newWebsiteURL,
    avatarBlob: newAvatarImage,
    bannerBlob: newBannerImage,
    labels: newLabels,
    joinedViaStarterPack: newJoinedViaStarterPack,
    pinnedPost: newPinnedPost,
    createdAt: Date()
)

Because putRecord replaces the whole record, the omitted field is deleted.

Lingua principale
Swift
Stelle
226
Fork
40
Merge medio
5h 8m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MasterJ93/ATProtoKit

Tutte le issue di MasterJ93/ATProtoKit

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.