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

[Payment 2024-12-17] [$250] Chat - Newline marker is shown on system message when returning back to the expense thread #53000

Closed
1 of 8 tasks
lanitochka17 opened this issue Nov 23, 2024 · 19 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

@lanitochka17
Copy link

lanitochka17 commented Nov 23, 2024

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: 9.0.66-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): applausetester+bg@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Create an expense in workspace chat
  3. Go to report and add a category.
  4. Notice system message is create but no newline shown.
  5. Go back to the main chat and return to the report

Expected Result:

Newline marker is not shown

Actual Result:

Newline marker 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
Bug6673835_1732334661477.Screen_Recording_2024-11-23_at_6.54.52_in_the_morning.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021863726493070062798
  • Upwork Job ID: 1863726493070062798
  • Last Price Increase: 2024-12-02
Issue OwnerCurrent Issue Owner: @strepanier03
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 23, 2024
Copy link

melvin-bot bot commented Nov 23, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

New message marker shows for update category system message.

What is the root cause of that problem?

This only happens in a one expense report. In a one expense report, when we edit the money request, the edit system message is added to the transaction thread. The one expense report shows a combined report actions between the expense report itself and the transaction thread. For showing the new message marker, we compare the unreadMarkerTime (report last read time) with the action created value.

const isCurrentMessageUnread = ReportActionsUtils.isReportActionUnread(message, unreadMarkerTime);

Since editing the money request adds the action to the transaction thread, the expense report lastReadTime is unchanged and the edit system message created is bigger than the expense report lastReadTime, thus the new message line is shown.

Why this only happen after reopening the report? It's because we set the unread marker to the report lastReadTime once and then it gets updated when there is a new message, which is the edit system message in this case.

const mostRecentReportActionCreated = lastAction?.created ?? '';
if (mostRecentReportActionCreated <= unreadMarkerTime) {
return;
}
setUnreadMarkerTime(mostRecentReportActionCreated);

But when we reopen the report, the unreadMarkerTime is set with the expense report lastReadTime.

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

We should use the transaction thread report lastReadTime if it's bigger than the expense report lastReadTime, similar to what we did to lastVisibleActionCreated.

const lastVisibleActionCreated =
(transactionThreadReport?.lastVisibleActionCreated ?? '') > (report.lastVisibleActionCreated ?? '')
? transactionThreadReport?.lastVisibleActionCreated
: report.lastVisibleActionCreated;

const lastReadTime =
    (transactionThreadReport?.lastReadTime ?? '') > reportLastReadTime
        ? transactionThreadReport?.lastReadTime
        : reportLastReadTime;

const [unreadMarkerTime, setUnreadMarkerTime] = useState(lastReadTime);
useEffect(() => {
    setUnreadMarkerTime(lastReadTime);

    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [report.reportID]);

@melvin-bot melvin-bot bot added the Overdue label Nov 26, 2024
Copy link

melvin-bot bot commented Nov 27, 2024

@strepanier03 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Nov 29, 2024

@strepanier03 Huh... This is 4 days overdue. Who can take care of this?

@strepanier03 strepanier03 added the External Added to denote the issue can be worked on by a contributor label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

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

@melvin-bot melvin-bot bot changed the title Chat - Newline marker is shown on system message when returning back to the expense thread [$250] Chat - Newline marker is shown on system message when returning back to the expense thread Dec 2, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
@hungvu193
Copy link
Contributor

Thanks, @bernhardoj 's proposal here looks good and tests well!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 4, 2024

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

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

PR is ready

cc: @hungvu193

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 4, 2024
@rafecolton
Copy link
Member

Requested a small change

@muttmuure muttmuure moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Dec 9, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 10, 2024
@melvin-bot melvin-bot bot changed the title [$250] Chat - Newline marker is shown on system message when returning back to the expense thread [HOLD for payment 2024-12-17] [$250] Chat - Newline marker is shown on system message when returning back to the expense thread Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.73-8 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-12-17. 🎊

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

  • @hungvu193 requires payment through NewDot Manual Requests
  • @bernhardoj requires payment through NewDot Manual Requests

Copy link

melvin-bot bot commented Dec 10, 2024

@hungvu193 @strepanier03 @hungvu193 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 17, 2024
Copy link

melvin-bot bot commented Dec 17, 2024

Payment Summary

Upwork Job

BugZero Checklist (@strepanier03)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1863726493070062798/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in [#whatsnext] #expense Dec 17, 2024
@strepanier03
Copy link
Contributor

@hungvu193 - Can you please complete the checklist mentioned here?

@strepanier03 strepanier03 changed the title [HOLD for payment 2024-12-17] [$250] Chat - Newline marker is shown on system message when returning back to the expense thread [Payment 2024-12-17] [$250] Chat - Newline marker is shown on system message when returning back to the expense thread Dec 19, 2024
@hungvu193
Copy link
Contributor

hungvu193 commented Dec 20, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: https://github.com/Expensify/App/pull/51174/files#r1893459180

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal

Test:

  1. Open a workspace chat with no unsettled expenses
  2. Create one new money request
  3. Open the expense report
  4. Update the money request information (any)
  5. Go back to workspace chat
  6. Open the expense report again
  7. Verify there is no new message marker

Do we agree 👍 or 👎

@strepanier03
Copy link
Contributor

@hungvu193 @bernhardoj - The payment summary is here and you're welcome to request payment.

I'll close this out now, thank you both, have a lovely new year!

@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in [#whatsnext] #expense Dec 20, 2024
@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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
Status: Done
Development

No branches or pull requests

6 participants