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 2023-11-29] [$500] The email addresses of mentioned users in the "Invited" message are not copied along with the message #30272

Closed
6 tasks done
m-natarajan opened this issue Oct 24, 2023 · 25 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production 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 Oct 24, 2023

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: 1.3.90-1
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: @ayazhussain79
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1698094454192599

Action Performed:

  1. Go to Send message > Room
  2. Complete the room creation flow
  3. Go to the room detail and click on members
  4. Click on "Invite" and invite some members
  5. After inviting, hover over the "Invited" message
  6. Click on "Copy to clipboard" and paste it in a chat
  7. Notice that the mentioned user's email is not copied along with the message

Expected Result:

The email addresses of mentioned users in the "Invited" message should also be copied along with the message

Actual Result:

The email addresses of mentioned users in the "Invited" message are not copied with the message

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

Android: Native
Screen.Recording.2023-10-24.at.2.47.36.AM.mov
Android: mWeb Chrome
Screen.Recording.2023-10-24.at.3.07.33.AM.mov
iOS: Native
Screen.Recording.2023-10-24.at.2.20.00.AM.mov
iOS: mWeb Safari
Screen.Recording.2023-10-24.at.2.17.26.AM.mov
MacOS: Chrome / Safari
Recording.153.mp4
MacOS: Desktop
Screen.Recording.2023-10-24.at.2.14.09.AM.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0138b8048fa3e5a82c
  • Upwork Job ID: 1716849531635449856
  • Last Price Increase: 2023-10-24
  • Automatic offers:
    • cubuspl42 | Reviewer | 27512058
    • dukenv0307 | Contributor | 27512059
@m-natarajan m-natarajan added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 24, 2023
@melvin-bot melvin-bot bot changed the title The email addresses of mentioned users in the "Invited" message are not copied along with the message [$500] The email addresses of mentioned users in the "Invited" message are not copied along with the message Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

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

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 24, 2023

Proposal

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

The email addresses of mentioned users in the "Invited" message are not copied along with the message

What is the root cause of that problem?

We don't have a special case for INVITETOROOM action when we click on copy to clipboard

onPress: (closePopover, {reportAction, selection}) => {

And then this will return the text that is converted from html of reportAction. Because the mention-user only has the accountID attr, the copied text doesn't contain the email address of mentioned users.
Screenshot 2023-10-24 at 23 31 36

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

We should add a special case for INVITETOROOM and then create a util function to get the message for this action like getInviteToRoomMessage.

In this function, we will get the list accountID from targetAccountIDs of originalMessage of the action. Then get the displayNameOrLogin of the list account base on the accountID and personalDetaiList and return the message with the same format which this action is displayed

What alternative solutions did you explore? (Optional)

@s-alves10
Copy link
Contributor

Proposal

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

The email addresses of mentioned users in the "Invited" message are not copied when copying to clipboard

What is the root cause of that problem?

Invited message contains mention-user element in a new format: <mention-user accountID={xxxxxxxxxxx}></mention-user>
We convert html to markdown or text when copying to clipboard

Clipboard.setString(parser.htmlToMarkdown(content));

const plainText = parser.htmlToText(content);

But the current htmlToMarkdown or htmlToText engine doesn't take care of the new format of mention-user and simply returns empty string
This is the root cause

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

We need to care about the new type of user mentions

  1. Add a new argument to the constructor of ExpensiMark
    constructor(getLoginsByAccountIDs) {
        this.getLoginsByAccountIDs = getLoginsByAccountIDs;

        ...
    }
  1. Add the following rules to the htmlToMarkdownRules and htmlToTextRules of ExpensiMark.js
        {
            name: 'mention-user',
            regex: /<(mention-user)(?:\s+accountID="?(\d+)"?)?>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
            replacement: (match, g1, g2, g3) => {
                if (g2 && typeof this.getLoginsByAccountIDs === 'function') {
                    const logins = this.getLoginsByAccountIDs([g2]);
                    return (logins && logins.length > 0) ? logins[0] : '';
                }
                return g3;
            }
        },

Note: Shouldn't be the last rule in htmlToTextRules because the current last rule removes all script tags

  1. Update
    const parser = new ExpensiMark();

    to
        const parser = new ExpensiMark(PersonalDetailsUtils.getLoginsByAccountIDs);

and update

const parser = new ExpensiMark();

to

        const parser = new ExpensiMark(PersonalDetailsUtils.getLoginsByAccountIDs);

This way, we can process the new type of user mentions

Result
issue_04.mp4

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@cubuspl42, @stephanieelliott Huh... This is 4 days overdue. Who can take care of this?

@stephanieelliott
Copy link
Contributor

Hey @cubuspl42 looks like we have a few proposals here -- can you review when you have a sec?

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2023
@cubuspl42
Copy link
Contributor

@s-alves10 While this idea is interesting, I don't believe that ExpensiMark is the appropriate abstraction level to solve this problem. ExpensiMark is abstracted from Expensify domain logic and it should stay that way.

@cubuspl42
Copy link
Contributor

The solution suggested by @dukenv0307 is reasonable and should be relatively simple to implement.

I approve it.

C+ reviewed 🎀 👀 🎀

Copy link

melvin-bot bot commented Oct 31, 2023

Triggered auto assignment to @bondydaa, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@s-alves10
Copy link
Contributor

@cubuspl42

Thank you for reviewing the proposal.

Here is my question.
We have a new format of user mention. This new format may appear in several places of the entire app. So I thought that ExpensiMark is the right place to parsing the message as it is for other messages.

cc @bondydaa

@melvin-bot melvin-bot bot added the Overdue label Nov 3, 2023
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 3, 2023
Copy link

melvin-bot bot commented Nov 3, 2023

📣 @cubuspl42 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Nov 3, 2023

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

Copy link

melvin-bot bot commented Nov 3, 2023

📣 @ayazhussain79 We're missing your Upwork ID to automatically send you an offer for the Reporter role.
Once you apply to the Upwork job, your Upwork ID will be stored and you will be automatically hired for future jobs!

@melvin-bot melvin-bot bot removed the Overdue label Nov 3, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 6, 2023
@dukenv0307
Copy link
Contributor

@cubuspl42 The PR is ready for reiview.

@stephanieelliott
Copy link
Contributor

PR approved but undergoing QA

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 22, 2023
@melvin-bot melvin-bot bot changed the title [$500] The email addresses of mentioned users in the "Invited" message are not copied along with the message [HOLD for payment 2023-11-29] [$500] The email addresses of mentioned users in the "Invited" message are not copied along with the message Nov 22, 2023
Copy link

melvin-bot bot commented Nov 22, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 22, 2023
Copy link

melvin-bot bot commented Nov 22, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.1-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 2023-11-29. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

Copy link

melvin-bot bot commented Nov 22, 2023

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:

  • [@cubuspl42] The PR that introduced the bug has been identified. Link to the PR:
  • [@cubuspl42] 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:
  • [@cubuspl42] 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:
  • [@cubuspl42] Determine if we should create a regression test for this bug.
  • [@cubuspl42] 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.
  • [@stephanieelliott] 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 Nov 28, 2023
@stephanieelliott
Copy link
Contributor

Hey @cubuspl42 can you complete the BZ checklist when you get a chance?

@stephanieelliott
Copy link
Contributor

Summarizing payment on this issue:

  • Issue reporter: @ayazhussain79 $50, to pay via Upwork -- @ayazhussain79 I've extended the job offer to you in Upwork, can you please accept when you get a chance?
  • Contributor: @dukenv0307 $500, paid via Upwork
  • Contributor+: @cubuspl42 $500, paid via Upwork

Upwork job is here

@cubuspl42
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR:
    • N/A (this was a sort of an unimplemented feature)
  • 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:
    • N/A
  • 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:
    • No need for additional discussion
  • Determine if we should create a regression test for this bug.
    • Up to the QA team
  • 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.
    • Create a room in some workspace
    • Click/tap on the header of the room, choose "Invite"
    • Invite some users
    • After the invite changelog message appears, hover over this message and click on copy to clipboard
    • Paste it to composer, verify that the pasted message looks the same as the invite message displayed
    • Go to #admin room of the workspace the room was created in
    • Copy the changelog message related to the newly invited users
    • Paste it to composer, and verify that the message that was pasted looks the same as the invite message displayed

@ayazhussain79
Copy link
Contributor

@stephanieelliott Offer accepted, Thank you

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2023
@stephanieelliott
Copy link
Contributor

All paid up, thanks!

Issue for regression test here: https://github.com/Expensify/Expensify/issues/new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production 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
None yet
Development

No branches or pull requests

7 participants