@@ -11,28 +11,43 @@ extension Contact {
1111 /// the message bubble renders - keeps those rows in sync with the bubble after
1212 /// a participant changes their photo.
1313 ///
14- /// Name, emoji, and other identity fields are deliberately left as the stored
15- /// contact's, so contact-authoritative name resolution (and any future local
16- /// nickname) is unaffected - only the avatar image is freshened.
14+ /// The avatar image (url + its crypto) is taken wholesale from the member
15+ /// profile - never field-by-field merged with the stored contact - so a
16+ /// change-photo shows the new image, and a partial/malformed member avatar
17+ /// renders the same monogram as the bubble (copying the fields verbatim keeps
18+ /// `Profile.isEncryptedImage`'s all-or-nothing crypto check identical).
19+ ///
20+ /// The display name is deliberately left as the stored contact's, so
21+ /// contact-authoritative name resolution (and any future local nickname) is
22+ /// unaffected - only the avatar is freshened.
23+ ///
24+ /// Known limitation (deferred): this does not handle a member who *clears*
25+ /// their avatar (nil url) or switches to emoji-only. The caller renders via
26+ /// `Profile.overlaying(contact:)`, which falls back to the frozen per-message
27+ /// snapshot's avatar/metadata when the override carries no avatar url, so the
28+ /// row would resurface the stale snapshot photo/emoji rather than the member's
29+ /// cleared state. There is no UI to clear an avatar today, so this is
30+ /// unreachable in practice; it is fully resolved by member-authoritative
31+ /// rendering (`displayAvatar(for:)`) in the ProfilesRepository refactor, when
32+ /// this whole stopgap is removed.
1733 ///
1834 /// Interim stopgap: remove once identity resolves from ProfilesRepository
1935 /// (see docs/plans/2026-06-29-profile-table-implementation.md, section 10.1).
2036 static func liveOverride( member: Profile , stored: Contact ? ) -> Contact {
21- let hasMemberAvatar = member. avatar != nil
22- return Contact (
37+ Contact (
2338 inboxId: member. inboxId,
2439 displayName: stored? . displayName,
25- avatarURL: hasMemberAvatar ? member. avatar : stored ? . avatarURL ,
26- avatarSalt: hasMemberAvatar ? member. avatarSalt : stored ? . avatarSalt,
27- avatarNonce: hasMemberAvatar ? member. avatarNonce : stored ? . avatarNonce,
28- avatarKey: hasMemberAvatar ? member. avatarKey : stored ? . avatarKey,
40+ avatarURL: member. avatar,
41+ avatarSalt: member. avatarSalt,
42+ avatarNonce: member. avatarNonce,
43+ avatarKey: member. avatarKey,
2944 addedAt: stored? . addedAt ?? Date ( ) ,
3045 addedViaConversationId: stored? . addedViaConversationId,
3146 isBlocked: stored? . isBlocked ?? false ,
3247 agentVerification: stored? . agentVerification,
3348 agentTemplateId: stored? . agentTemplateId,
3449 agentTemplatePublishedURL: stored? . agentTemplatePublishedURL,
35- profileEmoji: stored ? . profileEmoji
50+ profileEmoji: member . profileEmoji
3651 )
3752 }
3853
0 commit comments