Skip to content

fix(chat): stop a sender's name flipping to their phone number - #1621

Merged
bmc08gt merged 2 commits into
code/cashfrom
fix/chat-member-profile-merge
Sep 29, 2026
Merged

bmc08gt merged 2 commits into
code/cashfrom
fix/chat-member-profile-merge

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

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_profiles row 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.upsertMembers now keeps a stored phone or email when the incoming copy has none and replaces every other column as before. ChatMemberDataSource uses 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. NotificationService took ContactResolver.resolveName first, 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 so planMessageBody still strips it from a body the server prefixed with it.

The order lives in planSenderName/senderNameCandidates in SenderAttributionPlanner.kt, tested in SenderAttributionPlannerTest. The member-write behaviour is covered in UserProfileDaoTest.

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.
@bmc08gt bmc08gt self-assigned this Sep 29, 2026
@github-actions github-actions Bot added type: fix Bug fix area: notifications Push notifications, in-app messaging and removed type: fix Bug fix labels Sep 29, 2026
@bmc08gt
bmc08gt merged commit 2144644 into code/cash Sep 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: notifications Push notifications, in-app messaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant