Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-04-15] [$500] [HIGH] When mentioning a user the "actionable whisper" message shows the full display name #38079

Closed
1 of 6 tasks
m-natarajan opened this issue Mar 11, 2024 · 77 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Mar 11, 2024

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: 1.4.50-2
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @quinthar
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1710108211692399

Action Performed:

  1. Open any room
  2. mention someone in the compose box and send
  3. Look at the "actionable whisper" message Heads up, @B B isn't a member of this room.

Expected Result:

This shouldn't show full display name

Actual Result:

Shows full display name

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Recording.2836.mp4

Screen Shot 2024-03-11 at 2 49 51 PM

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c8171385c92b3a6a
  • Upwork Job ID: 1767266276761448448
  • Last Price Increase: 2024-03-18
  • Automatic offers:
    • ahmedGaber93 | Contributor | 0
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 11, 2024
Copy link

melvin-bot bot commented Mar 11, 2024

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@m-natarajan m-natarajan changed the title When mentioning a user the "actionable whisper" message shows the full display name [HIGH] When mentioning a user the "actionable whisper" message shows the full display name Mar 11, 2024
@ShridharGoel
Copy link
Contributor

ShridharGoel commented Mar 11, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

When mentioning a user the "actionable whisper" message shows the full display name.

What is the root cause of that problem?

displayName is used here, which leads to the full display name being shown.

function getEffectiveDisplayName(personalDetail?: PersonalDetails): string | undefined {
if (personalDetail) {
return LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? '') || personalDetail.displayName;
}
return undefined;
}

What changes do you think we should make in order to solve the problem?

firstName should be used.

function getEffectiveDisplayName(personalDetail?: PersonalDetails): string | undefined {
    if (personalDetail) {
        return LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? '') || personalDetail.firstName;
    }

    return undefined;
}

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Mar 11, 2024
@melvin-bot melvin-bot bot changed the title [HIGH] When mentioning a user the "actionable whisper" message shows the full display name [$500] [HIGH] When mentioning a user the "actionable whisper" message shows the full display name Mar 11, 2024
Copy link

melvin-bot bot commented Mar 11, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01c8171385c92b3a6a

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 11, 2024
Copy link

melvin-bot bot commented Mar 11, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

@abzokhattab
Copy link
Contributor

abzokhattab commented Mar 11, 2024

Expected Result:
This shouldn't show full display name

what is the correct result then? @sobitneupane @quinthar

@whitestar613910
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.

When mentioning a user the "actionable whisper" message shows the full display name.

What is the root cause of that problem?

displayName is used here, which leads to the full display name being shown.

function getEffectiveDisplayName(personalDetail?: PersonalDetails): string | undefined {
if (personalDetail) {
return LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? '') || personalDetail.displayName;
}
return undefined;
}

What changes do you think we should make in order to solve the problem?

firstName should be used.

function getEffectiveDisplayName(personalDetail?: PersonalDetails): string | undefined {
    if (personalDetail) {
        return LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? '') || personalDetail.firstName;
    }

    return undefined;
}

The problem at hand involves the "actionable whisper" message displaying the full user's display name when mentioning them.

The root cause of this issue lies in the use of the displayName attribute in the getEffectiveDisplayName function, which results in the presentation of the complete display name instead of the intended behavior. The function relies on LocalePhoneNumber.formatPhoneNumber for formatting or defaults to the firstName of the personal details if available.

Copy link

melvin-bot bot commented Mar 11, 2024

📣 @whitestar613910! 📣
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:

  1. Make sure you've read and understood the contributing guidelines.
  2. 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.
  3. 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.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@ghost
Copy link

ghost commented Mar 11, 2024

@sobitneupane what is the expected result ? firstName, lastName or email. What is it? Can you please mention that ?

@whitestar613910
Copy link

Contributor details
your Expensify account email: [email protected]
Upwork profile Link: https://www.upwork.com/freelancers/~010bbce3c00ea08221?s

The problem at hand involves the "actionable whisper" message displaying the full user's display name when mentioning them.

The root cause of this issue lies in the use of the displayName attribute in the getEffectiveDisplayName function, which results in the presentation of the complete display name instead of the intended behavior. The function relies on LocalePhoneNumber.formatPhoneNumber for formatting or defaults to the firstName of the personal details if available.

The problem at hand involves the "actionable whisper" message displaying the full user's display name when mentioning them.

The root cause of this issue lies in the use of the displayName attribute in the getEffectiveDisplayName function, which results in the presentation of the complete display name instead of the intended behavior. The function relies on LocalePhoneNumber.formatPhoneNumber for formatting or defaults to the firstName of the personal details if available.

Copy link

melvin-bot bot commented Mar 11, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@nkdengineer
Copy link
Contributor

nkdengineer commented Mar 12, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Shows full display name

What is the root cause of that problem?

In MentionUserRenderer.tsx, we get the display name or login via getDisplayNameOrDefault

displayNameOrLogin = PersonalDetailsUtils.getDisplayNameOrDefault(user, LocalePhoneNumber.formatPhoneNumber(user?.login ?? ''));

And in this function we only set the displayName as login if we don't have the custom displayName

if (displayName === passedPersonalDetails?.login && Str.isSMSLogin(passedPersonalDetails?.login)) {
displayName = Str.removeSMSDomain(displayName);
}

What changes do you think we should make in order to solve the problem?

In getDisplayNameOrDefault function, we can add an extra param like shouldPriozitizeLogin with default value as false

And then if shouldPriozitizeLogin is true, we will set displayName as login if login exists

let displayName = passedPersonalDetails?.displayName ? passedPersonalDetails.displayName.replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '') : '';
if (shouldPrioritizeLogin) {
    displayName = passedPersonalDetails?.login || displayName;
}

return displayName || defaultValue || fallbackValue;

With this change, all logic below still works correctly and we will return the login if it exists and shouldPriozitizeLogin is true

And then in MentionUserRenderer.tsx, we will pass shouldPriozitizeLogin as true into MentionUserRenderer.tsx and use getMentionDisplayText to drop the domain if the user is the same domain with the current user. With this change the display text for mention here #32534 (comment) is covered by PersonalDetailsUtils.getDisplayNameOrDefault and the domain can be dropped by getMentionDisplayText function

displayNameOrLogin = getMentionDisplayText(PersonalDetailsUtils.getDisplayNameOrDefault(user, LocalePhoneNumber.formatPhoneNumber(user?.login ?? ''), true, false, true), htmlAttribAccountID, user?.login ?? '');

displayNameOrLogin = PersonalDetailsUtils.getDisplayNameOrDefault(user, LocalePhoneNumber.formatPhoneNumber(user?.login ?? ''));

OPTIONAL: We can bring getMentionDisplayText to a util function and in this function we will use getDisplayNameOrDefault to get the display text first. So we can use this function in other places that we want like TaskView

OPTIONAL: Since getDisplayNameOrDefault has many argument, we can wrap this as an object with default value of each field in object and then when we use this function, we only need to pass the necessary field that we want

What alternative solutions did you explore? (Optional)

NA

@whitestar613910
Copy link

whitestar613910 commented Mar 12, 2024 via email

@ahmedGaber93
Copy link
Contributor

ahmedGaber93 commented Mar 12, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

When mentioning a user the "actionable whisper" message shows the full display name

What is the root cause of that problem?

This GitHub issue have two issues:

  1. show full name rather than email in wishper messages(see the video in issue description).
  2. shortened mentions not handled in wishper messages (see the screenshot in issue description).

the root cause is the "actionable whisper" message come from backend with accountID-based mentions - <mention-user accountID=1234></mention-here>, and we here set the priority to full name rather than email, and not handle the shortened mentions.

displayNameOrLogin = PersonalDetailsUtils.getDisplayNameOrDefault(user, LocalePhoneNumber.formatPhoneNumber(user?.login ?? ''));

What changes do you think we should make in order to solve the problem?

replace this line here with

displayNameOrLogin = LocalePhoneNumber.formatPhoneNumber(lodashGet(user, 'login', '')) || PersonalDetailsUtils.getDisplayNameOrDefault(user);
displayNameOrLogin = Str.removeSMSDomain(getMentionDisplayText(displayNameOrLogin, htmlAttributeAccountID, lodashGet(user, 'login', '')));

the first line will work as formatedPhoneNumber || login || displayName || hidden
the second line will work to handle short mentioned.

What alternative solutions did you explore? (Optional)

@whitestar613910
Copy link

whitestar613910 commented Mar 12, 2024 via email

@brandonhenry
Copy link
Contributor

brandonhenry commented Mar 12, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

The issue occurs when mentioning a user who is not a member of the chat room. In the actionable whisper message, the full display name is shown instead of the intended behavior, which should vary based on the domain and the available personal details.

What is the root cause of that problem?

The root cause of this issue is a regression introduced in PR #36998, where the order of preference for displaying the display name and login was changed. This change prioritized the display name over the login, which led to the full display name being shown in the actionable whisper message, even when the user is not a member of the chat room.

What changes do you think we should make in order to solve the problem?

While the changes from that PR were right and had good intentions, it caused this regression. I propose we fix by:

  1. Let's not rely on the getDisplayNameOrDefault function in PersonalDetailsUtils. Instead, let's define a new function in MentionUserRenderer that will get this name for us:
const getDisplayNameFromAccountID = (user: Partial<PersonalDetails> | null, htmlAttributeAccountID: string): string => {
    if (user && user.login) {
        return Str.removeSMSDomain(getMentionDisplayText(user.login, htmlAttributeAccountID));
    }

    return user?.displayName || LocalePhoneNumber.formatPhoneNumber(user?.login ?? '') || Localize.translateLocal('common.hidden');
};
  1. Now let's use the new function here instead
const user = personalDetails[htmlAttribAccountID];
accountID = parseInt(htmlAttribAccountID, 10);
displayNameOrLogin = getDisplayNameFromAccountID(user, htmlAttribAccountID);

Note: we can also just add an original getDisplayName function to MentionUserRenderer that will handle all cases where displayNameOrLogin is set in this file. So moving these conditions to the getDisplayName custom function we create inside of this component:

Move these to the function as well so we can just do displayNameOrLogin = getDisplayName(props)

displayNameOrLogin = tnodeClone.data.replace(CONST.UNICODE.LTR, '').slice(1);

displayNameOrLogin = Str.removeSMSDomain(displayNameOrLogin);

@whitestar613910
Copy link

whitestar613910 commented Mar 12, 2024 via email

@whitestar613910
Copy link

whitestar613910 commented Mar 12, 2024 via email

@puneetlath
Copy link
Contributor

Just to clarify the behavior, all mentions, whether they are login-based or accountID-based should follow what is described here: #32534 (comment)

@brandonhenry
Copy link
Contributor

brandonhenry commented Mar 12, 2024

Updated proposal based on @puneetlath details.

Though, re-reading your comment @puneetlath, i wonder if how it working right now is intended? If the user is on the same domain and has personalDetail with login, it renders like email-based mentions, which ultimately leads to rendering If it's on the same private domain as mine, render as @person. Otherwise render as @[email protected].

That's how it is currently working in and why this is happening in the first place. Thoughts?

I'm thinking, if we do want to fix this ticket's issue, then there needs to be an additional case for email-based mentions that is if member of the room, show display name. If not member of room, show login

Cc. @sobitneupane @adelekennedy

@whitestar613910
Copy link

I think you want to update the PersonalDetailsUtils.getDisplayNameOrDefault function to handle mentions more flexibly. The proposed changes include adding a new property defaultToLogin to the function's input object, and modifying the function to return the login if defaultToLogin is true and the login property exists in the personalDetails object. The rest of the function remains the same, handling the display name logic based on the other properties.

const displayNameOrLogin = PersonalDetailsUtils.getDisplayNameOrDefault({
personalDetails: user,
defaultValue: LocalePhoneNumber.formatPhoneNumber(user?.login ?? ''),
defaultToLogin: !ReportUtils.getReport(currentReportID)?.participantAccountIDs?.includes(Number(htmlAttributeAccountID)),
});

This change will allow you to specify exactly when you want a shortened/hidden display name or if you want to only use the login as the display name.

@ahmedGaber93
Copy link
Contributor

my proposal work fine in both.
the "actionable whisper" message come from backend with accountID-based mentions - <mention-user accountID=1234></mention-here> and my proposal fix it without any affect on email based mentions, so both work fine with me.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Mar 25, 2024
@ahmedGaber93
Copy link
Contributor

@sobitneupane PR #38957 is ready for review.

Copy link

melvin-bot bot commented Apr 2, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 8, 2024
@melvin-bot melvin-bot bot changed the title [$500] [HIGH] When mentioning a user the "actionable whisper" message shows the full display name [HOLD for payment 2024-04-15] [$500] [HIGH] When mentioning a user the "actionable whisper" message shows the full display name Apr 8, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 8, 2024
Copy link

melvin-bot bot commented Apr 8, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Apr 8, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-04-15. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Apr 8, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@adelekennedy] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 14, 2024
@adelekennedy
Copy link

adelekennedy commented Apr 15, 2024

Payouts due:

Upwork job is here.

@adelekennedy
Copy link

adelekennedy commented Apr 15, 2024

Payment summary above - just pending checklist if relevant @sobitneupane !

@adelekennedy adelekennedy removed the Awaiting Payment Auto-added when associated PR is deployed to production label Apr 15, 2024
@melvin-bot melvin-bot bot added the Overdue label Apr 17, 2024
@puneetlath
Copy link
Contributor

@sobitneupane bump on the checklist.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 17, 2024
@adelekennedy
Copy link

@sobitneupane will you complete the checklist today so we can close?

@sobitneupane
Copy link
Contributor

sobitneupane commented Apr 24, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

#36998

  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

#36998 (comment)

  • [@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@sobitneupane] Determine if we should create a regression test for this bug.

Yes.

  • [@sobitneupane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

#38079 (comment)

@sobitneupane
Copy link
Contributor

Regression Test Proposal:

  1. Open any room
  2. Mention someone who is not the room
  3. Notice the "actionable whisper" message
  4. Verify that login is displayed both in mention and actionable whisper.

@adelekennedy
Copy link

@JmillsExpensify
Copy link

$500 approved for @sobitneupane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests