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][$250] Mention-Numbers are displayed when editing an email mention of a user that is not a contact #45259

Closed
3 of 6 tasks
izarutskaya opened this issue Jul 11, 2024 · 44 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 Help Wanted Apply this label when an issue is open to proposals by contributors Reviewing Has a PR in review

Comments

@izarutskaya
Copy link

izarutskaya commented Jul 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: 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
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 11, 2024
Copy link

melvin-bot bot commented Jul 11, 2024

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.

@izarutskaya
Copy link
Author

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

@Tony-MK
Copy link
Contributor

Tony-MK commented Jul 11, 2024

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.

@nkdengineer
Copy link
Contributor

nkdengineer commented Jul 12, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Jul 15, 2024
@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Jul 16, 2024
Copy link

melvin-bot bot commented Jul 16, 2024

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

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

melvin-bot bot commented Jul 16, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jul 16, 2024
@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Jul 17, 2024

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

@puneetlath
Copy link
Contributor

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

@aimane-chnaif
Copy link
Contributor

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

@nkdengineer thanks for the proposal. Can you please find PR that added this line and confirm that falling back to displayName instead of accountID doesn't cause any regression?

@nkdengineer
Copy link
Contributor

@aimane-chnaif It comes from this PR #44732. It's simply something we display when we don't have a user login field so changing the fallback will not cause any regression.

@aimane-chnaif
Copy link
Contributor

@aimane-chnaif It comes from this PR #44732. It's simply something we display when we don't have a user login field so changing the fallback will not cause any regression.

@nkdengineer No. That PR just moved this line from old file to new file

@Tony-MK
Copy link
Contributor

Tony-MK commented Jul 22, 2024

@aimane-chnaif, Could you give feedback on my proposal?

I believe the best-excepted behavior is display @displayName.

@aimane-chnaif
Copy link
Contributor

@Tony-MK Thanks for the proposal but I think your solution is unnecessarily complex. Have you found any regression with @nkdengineer's simple solution?

@Tony-MK
Copy link
Contributor

Tony-MK commented Jul 22, 2024

Yeah.

According to my testing, the other proposal does not display @displayName but @hidden.

Therefore, editing a message, for example, @Alice would be @hidden after the edit.

Basically, like my second solution in my propsal

We should attempt the first solution.

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Jul 24, 2024

why not we simply update like this?
accountIDToNameMap[personalDetails.accountID] = personalDetails.login || personalDetails.displayName || String(personalDetails.accountID)

EDIT: we shouldn't do like that because it should show @Hidden instead of accountID when login, displayName don't exist

@nkdengineer
Copy link
Contributor

@aimane-chnaif Is there any problem with my proposal?

@aimane-chnaif
Copy link
Contributor

@nkdengineer your solution always shows @Hidden though @DisplayName exists. And #45259 (comment) was not confirmed yet.

@Tony-MK
Copy link
Contributor

Tony-MK commented Jul 25, 2024

And #45259 (comment) was not confirmed yet.

@aimane-chnaif, Do you want the PR that introduced this line?

@nkdengineer
Copy link
Contributor

@aimane-chnaif The change came from this PR #40565. And I see that in this PR we only test the case select the mention in suggestion list that already had the login field.

@nkdengineer
Copy link
Contributor

your solution always shows @hidden though @DisplayName exists.

What does that mean? It always shows when open edit composer or after editing?

Copy link

melvin-bot bot commented Jul 25, 2024

@kadiealexander @aimane-chnaif 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!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 8, 2024
@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Sep 2, 2024
Copy link

melvin-bot bot commented Sep 2, 2024

This issue has not been updated in over 15 days. @srikarparsi, @kadiealexander, @aimane-chnaif, @nkdengineer eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@nkdengineer
Copy link
Contributor

@kadiealexander The PR was deployed to production 2 weeks ago.

@kadiealexander
Copy link
Contributor

Ah sorry, the payment automation broke. Let me finish things now.

@kadiealexander
Copy link
Contributor

kadiealexander commented Sep 4, 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:

@kadiealexander kadiealexander added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Sep 4, 2024
@melvin-bot melvin-bot bot changed the title Mention-Numbers are displayed when editing an email mention of a user that is not a contact [$250] Mention-Numbers are displayed when editing an email mention of a user that is not a contact Sep 4, 2024
Copy link

melvin-bot bot commented Sep 4, 2024

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

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

melvin-bot bot commented Sep 4, 2024

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Monthly KSv2 labels Sep 4, 2024
@kadiealexander
Copy link
Contributor

kadiealexander commented Sep 4, 2024

Payouts due:

Upwork job is here.

@kadiealexander kadiealexander 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 Sep 4, 2024
@kadiealexander
Copy link
Contributor

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

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Sep 10, 2024

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

@nkdengineer
Copy link
Contributor

@kadiealexander I accepted the offer

@aimane-chnaif
Copy link
Contributor

@kadiealexander I'd like to use upwork

@kadiealexander
Copy link
Contributor

@aimane-chnaif sent you an offer!

@kadiealexander
Copy link
Contributor

@aimane-chnaif bump!

@kadiealexander
Copy link
Contributor

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

@aimane-chnaif
Copy link
Contributor

@kadiealexander I accepted offer. Sorry for delay

@kadiealexander
Copy link
Contributor

Paid, thanks @aimane-chnaif!

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 Help Wanted Apply this label when an issue is open to proposals by contributors Reviewing Has a PR in review
Projects
No open projects
Status: No status
Development

No branches or pull requests

7 participants