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

Chat - Mentions are not shown in expensify issue card thread page instead a double space shown #54630

Open
2 of 8 tasks
lanitochka17 opened this issue Dec 27, 2024 · 3 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Dec 27, 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: 9.0.79-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team
Component: Chat Report View

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Go to workspace settings - enable expensify card
  3. Issue a card
  4. Open workspace chat
  5. Open the reply in thread for the expensify issue card thread message

Expected Result:

Mentions must be shown in expensify issue card thread page and a double space must not be shown

Actual Result:

Mentions are not shown in expensify issue card thread page instead a double space is shown

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6703168_1735331811915.screenrecorder-2024-12-27-19-14-02-45.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 27, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

Triggered auto assignment to @sakluger (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.

@FitseTLT
Copy link
Contributor

FitseTLT commented Dec 27, 2024

Edited by proposal-police: This proposal was edited at 2024-12-27 21:26:29 UTC.

Proposal

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

Chat - Mentions are not shown in expensify issue card thread page instead a double space shown

What is the root cause of that problem?

For the thread header case when the assigned user hasn't set firstName BE will set it to empty string so the fallback of login here will not work as we use ?? so the assignee part will be empty

const assignee = shouldRenderHTML ? `<mention-user accountID="${assigneeAccountID}"/>` : assigneeDetails?.firstName ?? assigneeDetails?.login ?? '';

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

We need to use || instead to deal with empty string cases

    const assignee = shouldRenderHTML ? `<mention-user accountID="${assigneeAccountID}"/>` : assigneeDetails?.firstName || (assigneeDetails?.login ?? '');

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We can write a test for getCardIssuedMessage with shouldRenderHTML as false and assert that the assignee part is not empty string when the assignee firstName is empty string

What alternative solutions did you explore? (Optional)

We are intentionally displaying the assignee part with the firstName instead of the login for when shouldRenderHTML is false if we want it to consistent with the shouldRenderHTML case we can set it directly to assigneeDetails?.login instead of firstName.

@daledah
Copy link
Contributor

daledah commented Dec 28, 2024

Edited by proposal-police: This proposal was edited at 2024-12-28 04:55:56 UTC.

Proposal

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

Mentions are not shown in expensify issue card thread page instead a double space is shown

What is the root cause of that problem?

We can reproduce this issue in WS while inviting new users and remove the existing users

Screenshot 2024-12-28 at 11 50 29

In some cases, BE will return the following message

Screenshot 2024-12-28 at 11 38 37

<mention-user accountID=123456></<mention-user>

In here

and

const mentionUserRegex = /<mention-user accountID="(\d )" *\/>/gi;

we have the logic to convert html to text but it just covers the case <mention-user accountID="123456"/>

-> the html doesn't match with the defined regex, so we don't see the mentioned users

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

  1. We should update the regex about user mention here to be the same as this place
  2. But the regex here doesn't cover the case accountID is number

so we need to update it to

/(?:<mention-user accountID="?(\d )"?(?: *\/>|><\/mention-user>))|(?:<mention-user>(.*?)<\/mention-user>)/gi;

Use the same logic for mention-report
3. Use the new regex for mention-report and mention-user in parseReportActionHtmlToText and ExpensifyMark

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We should add new test in htmlToText for the following cases:

  • <mention-user accountID=123456></<mention-user>
  • <mention-user accountID="123456"></<mention-user>
  • <mention-user accountID=123456/>
  • <mention-user accountID="123456"/>

and mention-report

What alternative solutions did you explore? (Optional)

In parseReportActionHtmlToText we can apply the logic to wrap accountID inside "" if it's number. Then remove the closed tag </mention-user> to use self close tag />

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Result

Screenshot 2024-12-28 at 11 51 03

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
Projects
None yet
Development

No branches or pull requests

4 participants