Repository navigation
fix(chat): stop a sender's name flipping to their phone number - #1621
Merged
Merged
Conversation
A user's profile row is shared by every chat they're in, and each member-list write replaced it whole. The server includes a member's phone number in CONTACT_DM feeds but not in TIP_DM feeds, so the stored number depended on which chat was written last. A full sync writes TIP_DMs last, which cleared it. Member writes now keep a stored phone or email when the incoming copy has none, and replace every other column as before.
…umber The sender name came from ContactResolver.resolveName first, which returns a formatted number when the address book has no contact for it. A sender whose profile carried a phone number was shown as that number instead of their display name. Only an address-book name now comes before the profile's display name and handle; the formatted number is the last fallback. It stays in the candidate list so it's still stripped from a message body the server prefixed with it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A chat notification could name the same sender by their display name one time and by their formatted phone number the next. Two things combined to cause it.
The stored phone number depended on which chat was written last. A user's
user_profilesrow is shared by every chat they're in, and each member-list write replaced it whole (upsertFull, REPLACE). The server includes a member's phone number in the CONTACT_DM feed but not in the TIP_DM feed, and a full feed sync writes TIP_DMs last, so the number was usually cleared until something wrote a contact DM's members again.UserProfileDao.upsertMembersnow keeps a stored phone or email when the incoming copy has none and replaces every other column as before.ChatMemberDataSourceuses it for both member writes.A side effect: if a user removes their phone number, the old one stays on their row until a chat that carries contact details sends a different one. Nothing in the member response says a field was removed rather than left out, so the row can't tell those apart.
A phone number outranked the display name.
NotificationServicetookContactResolver.resolveNamefirst, and that returns a formatted number when the address book has no contact for it. Now only an address-book name (resolveContactName) comes before the profile's display name and handle, then the push title, with the formatted number last. The number stays in the candidate list soplanMessageBodystill strips it from a body the server prefixed with it.The order lives in
planSenderName/senderNameCandidatesinSenderAttributionPlanner.kt, tested inSenderAttributionPlannerTest. The member-write behaviour is covered inUserProfileDaoTest.