Skip to content

[HOLD for payment][$250] Mention-Numbers are displayed when editing an email mention of a user that is not a contact #45259

Closed

Description

@izarutskaya

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.6-0
Reproducible in staging?: Y
Reproducible in production?: Y
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat
  3. Send a message containing "@" mentioning an existing user but is not in your contact list
  4. Right-click on the message > Edit comment.
  5. Observe the edit field

Expected Result:

The mentioned user's full email address is displayed in the edit box

Actual Result:

User ID number is displayed in the edit box instead of the email address

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

Bug6538648_1720680873449.2024-07-11_09_51_38.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021831462503801260039
  • Upwork Job ID: 1831462503801260039
  • Last Price Increase: 2024-09-04
Issue OwnerCurrent Issue Owner: @kadiealexander
Issue OwnerCurrent Issue Owner: @kadiealexander

Activity

  1. added
    Daily
    Bug
    on Jul 11, 2024
  2. melvin-bot commented on Jul 11, 2024

    @melvin-bot

    Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. izarutskaya commented on Jul 11, 2024

    @izarutskaya
    Author

    We think this issue might be related to the #vip-vsb

  4. Tony-MK commented on Jul 11, 2024

    @Tony-MK
    Contributor

    Proposal

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

    Mention-Numbers are displayed when editing an email mention of a user that is not a contact

    What is the root cause of that problem?

    The root cause of the problem is the Parser.htmlTomakdown function needs an accountIDToName map to convert the mentioned accountIDs to the respective name.

    This issue occurs in the Report.saveReportActionDraft function in the ContextMenuActions.tsx file

    if (!draftMessage) {
    Report.saveReportActionDraft(reportID, reportAction, Parser.htmlToMarkdown(getActionHtml(reportAction)));
    } else {

    Therefore, the Parser.htmlTomakdown function returns the raw accountID because the HTML looks like the below example.

    "<mention-user accountID="17038670"/>"

    It returns @17038670 instead of @Alice and saves the draft as @17038670 in the onyx.

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

    We should pass an accountIDToName object for the extras argument for the Parser.htmlTomakdown.

    1. The First Solution which displays "@Alice"

    We should create the accountIDToName record just before calling the Report.saveReportActionDraft function.

    So, the code that will create the accountIDToName object should look similar to the one below.

    const accountIDToName: Record<string, string> = {} as Record<string, string>;
    
    if (reportAction.originalMessage?.mentionedAccountIDs) {
        reportAction.originalMessage.mentionedAccountIDs.forEach((accountID: number) => {
            accountIDToName[accountID] = ReportUtils.getDisplayNameForParticipant(accountID);
        });
    }
    
    Report.saveReportActionDraft(reportID, reportAction, Parser.htmlToMarkdown(getActionHtml(reportAction),  { accountIDToName }));
    
    Screen.Recording.2024-07-11.at.18.47.51.mov
    1. The Second Solution which displays "@Hidden"

    Introduce accountIDToName by the following example code shown below.

    accountIDToName: ReportUtils.getDisplayNameForParticipant as unknown as Record<string, string>
    
    Hidden.mov

    What alternative solutions did you explore? (Optional)

    We could use or create a function to display "@alice" instead of "@hidden" like the second solution illustrated above for cleaner code in one line.

  5. nkdengineer commented on Jul 12, 2024

    @nkdengineer
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-07 10:06:41 UTC.

    Proposal

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

    User ID number is displayed in the edit box instead of hidden

    What is the root cause of that problem?

    After we mention a user that we haven't chatted with before, BE returns the personal details of this user without login. And then accountIDToNameMap of this user is fallback to accountID

    accountIDToNameMap[personalDetails.accountID] = personalDetails.login ?? personalDetails.displayName ?? String(personalDetails.accountID);

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

    We should fallback as an empty string here then htmlToMarkdown function can display the user as Hidden by default here

    accountIDToNameMap[personalDetails.accountID] = personalDetails.login ?? personalDetails.displayName ?? String(personalDetails.accountID);

    What alternative solutions did you explore? (Optional)

    Result

    Screen.Recording.2024-08-07.at.17.05.04.mov
  6. added
    External
    on Jul 16, 2024
  7. melvin-bot commented on Jul 16, 2024

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  8. added
    Help Wanted
    on Jul 16, 2024
  9. melvin-bot commented on Jul 16, 2024

    @melvin-bot

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

  10. aimane-chnaif commented on Jul 17, 2024

    @aimane-chnaif
    Contributor

    @puneetlath what do you think is the expected behavior?
    As no way to get login (email), should show @displayName or @Hidden?

  11. puneetlath commented on Jul 18, 2024

    @puneetlath
    Contributor

    Hmm, weird scenario. Interesting. I think either is fine. I guess display name is better.

  12. 40 remaining items

  13. melvin-bot commented on Sep 4, 2024

    @melvin-bot

    Current assignee @aimane-chnaif is eligible for the External assigner, not assigning anyone new.

  14. added
    Daily
    and removed on Sep 4, 2024
  15. kadiealexander commented on Sep 4, 2024

    @kadiealexander
    Contributor

    Payouts due:

    Upwork job is here.

  16. changed the title [-][$250] Mention-Numbers are displayed when editing an email mention of a user that is not a contact[/-] [+][HOLD for payment][$250] Mention-Numbers are displayed when editing an email mention of a user that is not a contact[/+] on Sep 4, 2024
  17. kadiealexander commented on Sep 9, 2024

    @kadiealexander
    Contributor

    @nkdengineer please let me know when you accept the offer.
    @aimane-chnaif bump on completing the checklist!

  18. aimane-chnaif commented on Sep 10, 2024

    @aimane-chnaif
    Contributor

    Regression Test Proposal

    1. Go to any chat
    2. Send a message containing "@" mentioning an existing user without display name and not in your contacts list
    3. Verify that "@hidden" is shown
    4. Right-click on the message > Edit comment
    5. Observe the edit field
    6. Verify that "@hidden" is displayed in the edit box
  19. nkdengineer commented on Sep 10, 2024

    @nkdengineer
    Contributor

    @kadiealexander I accepted the offer

  20. aimane-chnaif commented on Sep 10, 2024

    @aimane-chnaif
    Contributor

    @kadiealexander I'd like to use upwork

  21. kadiealexander commented on Sep 12, 2024

    @kadiealexander
    Contributor

    @aimane-chnaif sent you an offer!

  22. kadiealexander commented on Sep 16, 2024

    @kadiealexander
    Contributor
  23. kadiealexander commented on Sep 18, 2024

    @kadiealexander
    Contributor

    @aimane-chnaif please reopen the issue once you've accepted the Upwork offer.

  24. aimane-chnaif commented on Sep 19, 2024

    @aimane-chnaif
    Contributor

    @kadiealexander I accepted offer. Sorry for delay

  25. kadiealexander commented on Sep 20, 2024

    @kadiealexander
    Contributor

    Paid, thanks @aimane-chnaif!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternalHelp WantedReviewing

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions