[$175] Web - Chat-no @hidden is shown after mention an existing user without display name
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.5.16-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/Expensify/issues/427767 Email or phone of affected tester (no customers): Issue reported by: Applause Internal Team Bug source: Device used: App Component:
Action Performed:
- Go to any chat
- Send a message containing "@" mentioning an existing user without display name and not in your contacts list
Expected Result:
"@hidden" is shown
Actual Result:
no @hidden is shown, it displayed as the user's email
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome / Safari
Screenshots/Videos
https://github.com/user-attachments/assets/48e7747d-7509-4aaa-bf49-d25ea95754a0
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022113295463543146018
- Upwork Job ID: 2113295463543146018
- Last Price Increase: 2026-10-22
Issue Owner
Current Issue Owner: @FitseTLT
⚠️ Preliminary analysis (low confidence) — treat as a starting point, not a conclusion.
I found no frontend regression. The App shows "@Hidden" only when it has neither an email nor a display name for the mentioned account. In this case it has the email, so it shows it. This is likely backend data, or the expected result may be outdated.
Two paths render a mention:
- Optimistic message: the client sends
<mention-user>@email</mention-user>with noaccountID(ParsingUtils.ts:110-130). The renderer shows the typed email (MentionUserRenderer.tsx:55-65). "Hidden" can't appear here. - After the server responds: if the tag has an
accountID, the renderer prefersloginover the display name (MentionUserRenderer.tsx:52). It falls back to "Hidden" only when both are empty (PersonalDetailsUtils.ts:91).
The "@Hidden" expectation came from Mention-Numbers are displayed when editing an email mention of a user that is not a contact. Back then, the backend returned a non-contact's personal details without login. That issue originally expected the full email. Unit tests cover both cases (MentionUserRendererTest.tsx:196-242). Recent commits to the renderer only refactor helpers.
I couldn't confirm this because the backend response isn't visible from the App repo. To confirm, check the AddComment response from a repro:
- Is the stored
htmlrewritten to<mention-user accountID="X"/>, or is it still the raw email? - Does
personalDetailsList[X]includelogin?
If the backend now returns login or skips the accountID rewrite, any fix is outside the App repo. An internal engineer needs to check it. Product may also decide that showing the email is fine, since the sender typed it. Then the test case needs updating, not the code.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (External)
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user sends a message that @-mentions an existing Expensify user who has no display name and is not in the sender's contacts, the rendered mention shows the raw email (e.g. @[email protected]). The expected result is @hidden, which is what the app shows for any mentioned user whose identity the viewer isn't allowed to see.
What is the root cause of that problem?
I could not verify this against the code, so this is my best reading of the rendering path, not a confirmed diagnosis.
The mention is rendered in MentionUserRenderer.tsx, which has two branches:
- The
accountidattribute is present. The display text ispersonalDetails[accountid].login || displayName || translate('common.hidden'). - There is no
accountidattribute. The renderer falls back to the raw text inside<mention-user>, strips the@, and shows it. This is the path for invites and unknown users.
For a user who is not in the contacts, the real account has no visible login or displayName for the viewer, so branch 1 correctly resolves to hidden.
The email is shown for one of two reasons:
- The optimistic message is parsed with
getAccountIDsByLogins, which creates a placeholder personal detail withlogin = <typed email>and a fake accountID. Branch 1 then prints that login. The placeholder is never reconciled with the real account. - The mention falls into branch 2, where the typed text is printed unconditionally, even though the login resolves to an existing account.
In both cases the renderer treats "the text the sender typed" or "a placeholder personal detail" as proof that the viewer may see the email, when it is only proof that the sender typed it.
What changes do you think we should make in order to solve the problem?
Change only the display-text resolution in src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx.
- Take the login from
personalDetailsonly when it is real. Ignore placeholder entries flaggedisOptimisticPersonalDetail. - If the mention resolves to a real accountID that exists in
personalDetailsbut has neither a visible login nor a displayName, showtranslate('common.hidden'). - Show the raw typed text only when the mention does not resolve to any existing account, which is the genuine invite or unknown case.
const getMentionText = (accountIDAttr?: string, rawData?: string) => {
if (accountIDAttr) {
const user = personalDetails?.[accountIDAttr];
const login = user?.isOptimisticPersonalDetail ? '' : user?.login;
return (
formatPhoneNumber(login ?? '') ||
formatPhoneNumber(user?.displayName ?? '') ||
translate('common.hidden')
);
}
const typed = rawData?.replace(CONST.UNICODE.LTR, '').slice(1) ?? '';
const resolvedID = getAccountIDsByLogins([typed])?.at(0);
const resolved = resolvedID ? personalDetails?.[resolvedID] : undefined;
// Existing real account whose details we cannot see -> hidden
if (resolved && !resolved.isOptimisticPersonalDetail && !resolved.login && !resolved.displayName) {
return translate('common.hidden');
}
return Str.removeSMSDomain(typed);
};
Keep the existing short-mention handling (getShortMentionIfFound) and navigation logic unchanged.
If the optimistic placeholder turns out to be the cause, also make sure the optimistic personal detail is cleaned up or overwritten once the server returns the real accountID. The renderer fix above covers the visible symptom either way.
What alternative solutions did you explore? (Optional)
- Always show
@hiddenwhen there is noaccountidattribute. This is simpler, but it breaks invite mentions of emails that have no account yet, which should still show the email. - Fix it on the backend by always emitting
accountidfor existing users. This is cleaner, but it is outside the App repo and does not fix the optimistic display on the client.
Testing
- Create or use an existing account that has no display name and is not in your contacts or any shared workspace.
- In any chat, send
@<that user's email>. - Verify the mention shows
@hidden, both optimistically and after the server response. - Verify a mention of a contact still shows the display name or login.
- Verify a mention of an email with no account still shows the email.
- Verify tapping the mention still navigates to the correct profile page.
- Add unit tests for
MentionUserRenderercovering the cases above:- an optimistic placeholder detail
- a real detail with no login or displayName
- a normal contact
- an unknown email
- Run the same checks on web and mobile.
Job added to Upwork: https://www.upwork.com/jobs/~022113295463543146018
Proposal
Problem
When mentioning an existing user with @<email> in a chat who is not in the viewer's contact list and does not have a display name configured, the mention is rendered as their full email address instead of @Hidden.
Root Cause
In src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx:
- When a mention is submitted without an
accountidattribute (e.g. optimistic comment or raw user tag<mention-user>@email</mention-user>), execution falls into lines 55–65 (else if ('data' in tnode && !isEmptyObject(tnode.data))). - Lines 63–65 extract the login string from the node (
mentionDisplayText = tnodeClone.data.replace(CONST.UNICODE.LTR, '').slice(1)), resolveaccountID = getAccountIDsByLogins([mentionDisplayText])?.at(0) ?? -1;, and formatmentionDisplayText. - However, the component completely bypasses
personalDetailslookup or privacy resolution for existing users whenaccountidis absent fromtnode.attributes. Even ifpersonalDetails[accountID]exists (or is resolved viagetAccountIDsByLogins), if the user is a non-contact whereloginanddisplayNameare restricted/empty or ifpersonalDetailsindicates no display name, it directly renders the typed text (<TNodeChildrenRenderer tnode={tnodeClone ?? tnode} />). - Furthermore, in lines 49–54 where
htmlAttribAccountIDis present:
mentionDisplayText = formatPhoneNumber(user?.login ?? '') || temporaryGetDisplayNameOrDefault({passedPersonalDetails: user, translate, formatPhoneNumber});
user?.login takes precedence over temporaryGetDisplayNameOrDefault. When an account is not in the viewer's contacts and has no custom display name, user.login shouldn't unconditionally expose the raw email if the expected display behavior for private/non-contact accounts without display names is to fallback to @Hidden via temporaryGetDisplayNameOrDefault. If user.isOptimisticPersonalDetail is populated by optimistic contact resolution, user.login is also present as the typed email.
Solution
- In
src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx:- When resolving display text with
htmlAttribAccountIDanduser:- If
useris an optimistic placeholder detail (user.isOptimisticPersonalDetail), do not treatuser.loginas verified personal detail. - Delegate display text formatting to
temporaryGetDisplayNameOrDefault({passedPersonalDetails: user, translate, formatPhoneNumber})instead of rawformatPhoneNumber(user?.login ?? '') || ..., so privacy fallbacks (includingtranslate('common.hidden')when neither contactdisplayNamenor public details are accessible) are properly respected.
- If
- When falling back to
'data' in tnode(optimistic mentions withoutaccountidattribute):- Resolve
accountIDusinggetAccountIDsByLogins([mentionDisplayText])?.at(0). - Check
personalDetails?.[accountID]. If the user is an existing account without a visibledisplayNameor with privacy restrictions (oraccountIDresolves to an existing non-contact account), format the display text usingtemporaryGetDisplayNameOrDefaultfalling back totranslate('common.hidden'), replacingtnodeClone.datawith@Hiddeninstead of displaying the raw email. - Keep raw typed text only when the email does not resolve to an existing account (invite scenario for new emails).
- Resolve
- When resolving display text with
if (!isEmpty(htmlAttribAccountID) && personalDetails?.[htmlAttribAccountID]) {
const user = personalDetails[htmlAttribAccountID];
accountID = parseInt(htmlAttribAccountID, 10);
const resolvedLogin = user?.isOptimisticPersonalDetail ? '' : (user?.login ?? '');
mentionDisplayText = temporaryGetDisplayNameOrDefault({
passedPersonalDetails: {...user, login: resolvedLogin},
translate,
formatPhoneNumber,
});
mentionDisplayText = getShortMentionIfFound(mentionDisplayText, htmlAttributeAccountID, currentUserPersonalDetails, resolvedLogin) ?? '';
navigationRoute = createDynamicRoute(DYNAMIC_ROUTES.PROFILE.getRoute(accountID), Navigation.getReportRHPActiveRoute());
} else if ('data' in tnode && !isEmptyObject(tnode.data)) {
tnodeClone = cloneDeep(tnode);
mentionDisplayText = tnodeClone.data.replace(CONST.UNICODE.LTR, '').slice(1);
accountID = getAccountIDsByLogins([mentionDisplayText])?.at(0) ?? -1;
const resolvedUser = accountID !== -1 ? personalDetails?.[accountID] : undefined;
if (resolvedUser && !resolvedUser.isOptimisticPersonalDetail && !resolvedUser.displayName) {
mentionDisplayText = translate('common.hidden');
asMutable(tnodeClone).data = `@${mentionDisplayText}`;
} else {
const shortMention = getShortMentionIfFound(mentionDisplayText, htmlAttributeAccountID, currentUserPersonalDetails) ?? '';
asMutable(tnodeClone).data = tnodeClone.data.replace(mentionDisplayText, Str.isSMSLogin(shortMention) ? formatPhoneNumber(shortMention) : shortMention);
mentionDisplayText = Str.isSMSLogin(mentionDisplayText) ? formatPhoneNumber(mentionDisplayText) : mentionDisplayText;
}
navigationRoute = createDynamicRoute(DYNAMIC_ROUTES.PROFILE.getRoute(accountID, mentionDisplayText), Navigation.getReportRHPActiveRoute());
}
Alternative Solutions Explored
- Backend-only modification: Letting backend rewrite the HTML before client receives the comment. However, this does not solve the optimistic rendering phase where the comment is immediately placed in the chat before backend socket sync.
- Replacing all mentions without display name with
@Hidden: Would break invites where users deliberately mention external contacts not yet signed up to Expensify. CheckingaccountID !== -1andpersonalDetails?.[accountID]guarantees only registered non-contact users are protected.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a chat, @-mentioning an existing user who has no display name (and is not in your contacts) renders the raw email address in the message, e.g. @[email protected]. Expected: @hidden is shown, matching the privacy behavior for unknown users.
What is the root cause of that problem?
In src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx, when the mentioned accountID resolves in personalDetails (branch 1), the display text is computed as formatPhoneNumber(user?.login ?? '') || temporaryGetDisplayNameOrDefault({passedPersonalDetails: user, translate, formatPhoneNumber}). For a user with no display name and a regular email login, formatPhoneNumber returns '' and temporaryGetDisplayNameOrDefault (src/libs/PersonalDetailsUtils.ts) falls through its chain: displayName is empty, so it returns login - the raw email. The @hidden privacy fallback (translate('common.hidden') via shouldFallbackToHidden) only applies in branch 3, when the user has no personal details at all. So a known-but-nameless user leaks their email while an unknown user correctly shows @hidden.
What changes do you think we should make in order to solve the problem?
- In
MentionUserRendererbranch 1, when the resolved user has nodisplayNameand the login is not an SMS login, fall back to the hidden translation -temporaryGetDisplayNameOrDefault({passedPersonalDetails: {...user, login: ''}, translate, formatPhoneNumber})(clearing the login forces theshouldFallbackToHiddenpath totranslate('common.hidden')), mirroring branch 3's behavior. - Keep the SMS-login path untouched (
formatPhoneNumberstill formats phone-number logins). - Add a case to
tests/unit/MentionUserRendererTest.tsx: user in personal details with an empty display name renders@hidden, not the email.
What alternative solutions did you explore?
Changing temporaryGetDisplayNameOrDefault itself to prefer "hidden" over the login would alter every consumer of that util (profile headers, tooltips, LHN) - far too broad. The renderer-local fix targets only the mention display path the issue reports.
I will verify: the exact repro (mention an existing user with no display name - @hidden renders); mentions of users WITH display names still show the name; mentions of SMS contacts still show the formatted number; the new unit test passes.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When sending a chat message that mentions (@[email protected]) an existing Expensify user who does not have a display name set and is not in the current user's contacts list, the mention is rendered as the raw email address (@[email protected]) instead of @Hidden.
What is the root cause of that problem?
There are two parts to this root cause in src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx:
-
When
<mention-user accountID="...">is rendered andpersonalDetails[htmlAttribAccountID]exists (MentionUserRenderer.tsx:46-54):- While typing
@[email protected]in the composer,SuggestionMention.tsx:147-151triggerssearchUserInServer(searchPrefix)(SearchForUsers), orpersonalDetails[accountID]is hydrated for the mentionedaccountIDwithout a customdisplayName(firstName/lastNameempty). - In
MentionUserRenderer.tsx:49-51:
As confirmed in https://github.com/Expensify/App/pull/73356, known contacts with amentionDisplayText = formatPhoneNumber(user?.login ?? '') || temporaryGetDisplayNameOrDefault({passedPersonalDetails: user, translate, formatPhoneNumber});loginintentionally display their@login(or short mention). However, when the mentioned user is an existing user not known to the current user (or hydrated without a display name / with only fallback details wheredisplayNameis not set or equals the hidden fallback),formatPhoneNumber(user?.login ?? '')still evaluates to a truthy email string (ifloginwas cached bySearchForUsersor optimistically), bypassingtemporaryGetDisplayNameOrDefault(translate('common.hidden')). - Additionally, when the backend returns
personalDetails[accountID]for a non-contact existing user without a display name,user.loginanduser.displayNameare omitted/empty ({accountID}), ortnodestill contains the optimistictnode.data(@[email protected]) whilehtmlAttribAccountIDis not yet set.
- While typing
-
When
tnode.datais rendered before/withouthtmlAttribAccountID(MentionUserRenderer.tsx:55-65):- In the
else if ('data' in tnode && !isEmptyObject(tnode.data))branch (MentionUserRenderer.tsx:55-65),accountIDis resolved viagetAccountIDsByLogins([mentionDisplayText])?.at(0) ?? -1. - Even when
accountID !== -1resolves to an existing user inpersonalDetailswho has nodisplayName(or whose details are hidden/anonymous),MentionUserRenderernever checkspersonalDetails[accountID]and unconditionally renders<TNodeChildrenRenderer tnode={tnodeClone ?? tnode} />with the raw email text.
- In the
What changes do you think we should make in order to solve the problem?
In src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx:
-
In the
htmlAttribAccountIDbranch (MentionUserRenderer.tsx:46-54):- Check whether the resolved
userinpersonalDetails[htmlAttribAccountID]has a display name (!isEmpty(user?.displayName)/firstName/lastName) or is a known contact vs. an existing user without a display name. - Specifically, when
userhas nodisplayName(e.g. an existing non-contact user without a display name whose record was hydrated withoutdisplayName, or an optimistic/unverified detail), fall back totemporaryGetDisplayNameOrDefault({passedPersonalDetails: undefined, translate, formatPhoneNumber})somentionDisplayTextresolves totranslate('common.hidden')(Hidden) instead of exposing the rawlogin, while preserving@loginfor known users who have adisplayNameset (keeping https://github.com/Expensify/App/pull/73356 and all existingMentionUserRendererTestcases intact).
- Check whether the resolved
-
In the
'data' in tnode && !isEmptyObject(tnode.data)branch (MentionUserRenderer.tsx:55-65):- After resolving
accountID = getAccountIDsByLogins([mentionDisplayText])?.at(0) ?? -1, checkconst user = accountID !== -1 ? personalDetails?.[accountID] : undefined;. - If
userexists inpersonalDetails(and is not merely an unverified optimistic invite placeholder) and has nodisplayName(!user.displayNameor!user.firstName && !user.lastName), setmentionDisplayText = translate('common.hidden')and updateasMutable(tnodeClone).data = `@${mentionDisplayText}`so that@Hiddenis displayed consistently.
- After resolving
-
Add unit tests in
tests/unit/MentionUserRendererTest.tsx:- Verify that mentioning an existing user in
personalDetailswho has nodisplayNamerenders@Hiddenboth whenaccountIDattribute is provided and whendata(@[email protected]) is provided. - Verify that existing tests (known user with
loginanddisplayName, same-domain short mention, SMS phone mention, and unknown external email mention) continue to pass.
- Verify that mentioning an existing user in
What alternative solutions did you explore? (Optional)
- Prioritizing
temporaryGetDisplayNameOrDefault(user)beforeformatPhoneNumber(user?.login ?? '')for all users: Rejected because that was previously tried in https://github.com/Expensify/App/pull/72291 and reverted in https://github.com/Expensify/App/pull/73356 — in Expensify, mentions of known users who have both aloginand adisplayNamemust render their handle/email (@login), not theirdisplayName. - Preventing
SuggestionMentionfrom callingsearchUserInServer: Rejected becauseSearchForUsersin mention autocomplete (added in https://github.com/Expensify/App/pull/99651) is an intended feature for discovering users not yet cached locally.
📣 @shilo1979jk! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0198ac866474035c04
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
In chat, when mentioning an existing user with @<email> who has no public display name configured and is not in the sender's contacts, the mention renders the raw email address instead of falling back to @Hidden.
What is the root cause of that problem?
In src/libs/PersonalDetailsUtils.ts, the helper temporaryGetDisplayNameOrDefault resolves the fallback name using the following priority order:
if (displayName) return displayName;if (defaultValue) return defaultValue;if (login) return login;return shouldFallbackToHidden ? temporaryHiddenTranslation : '';
Because step 3 unconditionally returns login whenever an email/login exists, the condition shouldFallbackToHidden at step 4 is unreachable for any valid user who has a login but lacks a display name. When a user has no display name and shouldFallbackToHidden is enabled (for contacts outside the user's workspace/address book), it should prioritize the privacy fallback (@Hidden) over exposing the raw login email.
What changes do you think we should make in order to solve the problem?
In src/libs/PersonalDetailsUtils.ts, inside temporaryGetDisplayNameOrDefault:
Prioritize shouldFallbackToHidden when a user has no explicit displayName:
if (displayName) {
return displayName;
}
if (shouldFallbackToHidden) {
return temporaryHiddenTranslation;
}
if (defaultValue) {
return defaultValue;
}
if (login) {
if (Str.isSMSLogin(login)) {
return formatPhoneNumber(login);
}
return login;
}
return '';
Additionally, ensure that in mention rendering (ReportUtils.getDisplayNameForParticipant), when the mentioned participant is not in personal details / contact list and has no custom display name, shouldFallbackToHidden is properly forwarded to temporaryGetDisplayNameOrDefault.
What alternative solutions did you explore? (Optional)
Handling the fallback only at the mention token parser/renderer level; however, fixing it centrally in temporaryGetDisplayNameOrDefault ensures consistent privacy behavior across mentions, room member previews, and optimistic participants without duplicating logic.
Test Result / Verification:
- Open web/desktop app.
- In any chat, type
@followed by an existing user's email who is not in your contacts and does not have a display name set. - Send the message.
- Verify the mention displays as
@Hiddeninstead of the raw email address. - Mention a user who DOES have a display name configured; verify their display name is rendered as expected.
@eh2077 Eep! 4 days overdue now. Issues have feelings too...
reassign issue cuz I'll be ooo
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)
I don't think this is a bug. Not from FE side AFAIK. Making this internal to make sure about this.
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @Gonals, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@shubham1206agra Whoops! This issue is 2 days overdue. Let's get this updated quick!
@shubham1206agra Whoops! This issue is 2 days overdue. Let's get this updated quick!
@Gonals Whoops! This issue is 2 days overdue. Let's get this updated quick!
@Gonals @shubham1206agra this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!