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 2024-10-14] [$250] Expense-Thread message for hold expense not shown in offline #49335

Open
3 of 6 tasks
IuliiaHerets opened this issue Sep 17, 2024 · 15 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Sep 17, 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.36-1
Reproducible in staging?: Y
Reproducible in production?: Y
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Go offline
  3. Open 1:1 DM
  4. Create a expense
  5. Long press the expense and then hold & unhold the expense
  6. Note reply thread not displayed
  7. Open the expense
  8. Note hold expense system message displayed
  9. Go online
  10. Go to conversation page
  11. After going online, thread reply message shown

Expected Result:

Thread message for hold expense must be shown in offline.

Actual Result:

Thread message for hold expense not shown in offline.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6606357_1726561952395.az_recorder_20240917_135453_compress_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021838745172566353951
  • Upwork Job ID: 1838745172566353951
  • Last Price Increase: 2024-09-25
  • Automatic offers:
    • FitseTLT | Contributor | 104144996
Issue OwnerCurrent Issue Owner: @anmurali
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 17, 2024
Copy link

melvin-bot bot commented Sep 17, 2024

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

@IuliiaHerets
Copy link
Author

@anmurali FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@FitseTLT
Copy link
Contributor

Proposal

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

Expense-Thread message for hold expense not shown in offline

What is the root cause of that problem?

In putOnHold here

App/src/libs/actions/IOU.ts

Lines 7841 to 7844 in 00bc167

function putOnHold(transactionID: string, comment: string, reportID: string) {
const currentTime = DateUtils.getDBTime();
const createdReportAction = ReportUtils.buildOptimisticHoldReportAction(currentTime);
const createdReportActionComment = ReportUtils.buildOptimisticHoldReportActionComment(comment, DateUtils.addMillisecondsFromDateTime(currentTime, 1));

we are only creating the report actions optimistically but not updating the parentReportAction with the necessary data such as childVisibleActionCount ...
Same problem exists in Unhold too.

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

In putOnHold we should optimistically update parentReportAction. We can use ReportUtils.getOptimisticDataForParentReportAction to get optimistic data with the necessary props for the parent action and set it to the optimistic data

    const parentReportActionOptimistic = ReportUtils.getOptimisticDataForParentReportAction(reportID, createdReportActionComment.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

we can also revert the changes on failureData.
Same should also be done unHoldRequest

    const parentReportActionOptimistic = ReportUtils.getOptimisticDataForParentReportAction(reportID, createdReportActionComment.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

One related problem I saw here is we are not updating the lastVisibleActionCreated of the report so the app doesn't auto- scroll to the newly created hold report actions so we can set lastVisibleActionCreated of the report optimistically for both hold (createdReportActionComment.created) and unhold (createdReportActionComment.created) cases.

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Sep 19, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

@anmurali Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Sep 24, 2024

@anmurali Still overdue 6 days?! Let's take care of this!

@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Sep 25, 2024
@melvin-bot melvin-bot bot changed the title Expense-Thread message for hold expense not shown in offline [$250] Expense-Thread message for hold expense not shown in offline Sep 25, 2024
Copy link

melvin-bot bot commented Sep 25, 2024

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

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

melvin-bot bot commented Sep 25, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2024
@ntdiary
Copy link
Contributor

ntdiary commented Sep 25, 2024

@FitseTLT, I generally agree with your proposal. I think the hold action is similar to sending a message, and we should try to update the parent report if it exists. However, interestingly, I'm not very sure if we should revert it back in the failureData, since I didn’t see this reversion in the send message function either. 😂

// Update optimistic data for parent report action if the report is a child report
const optimisticParentReportData = ReportUtils.getOptimisticDataForParentReportAction(reportID, currentTime, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

@FitseTLT
Copy link
Contributor

@FitseTLT, I generally agree with your proposal. I think the hold action is similar to sending a message, and we should try to update the parent report if it exists. However, interestingly, I'm not very sure if we should revert it back in the failureData, since I didn’t see this reversion in the send message function either. 😂

// Update optimistic data for parent report action if the report is a child report
const optimisticParentReportData = ReportUtils.getOptimisticDataForParentReportAction(reportID, currentTime, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

Agree 👍

@ntdiary
Copy link
Contributor

ntdiary commented Sep 25, 2024

OK, I think it' fine to move forward with your proposal. :)

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Sep 25, 2024

Triggered auto assignment to @Beamanator, 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 Sep 26, 2024
Copy link

melvin-bot bot commented Sep 26, 2024

📣 @FitseTLT 🎉 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 27, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 7, 2024
@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Oct 7, 2024
@melvin-bot melvin-bot bot changed the title [$250] Expense-Thread message for hold expense not shown in offline [HOLD for payment 2024-10-14] [$250] Expense-Thread message for hold expense not shown in offline Oct 7, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 7, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

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

Copy link

melvin-bot bot commented Oct 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.45-4 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-10-14. 🎊

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

Copy link

melvin-bot bot commented Oct 7, 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:

  • [@ntdiary] The PR that introduced the bug has been identified. Link to the PR:
  • [@ntdiary] 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:
  • [@ntdiary] 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:
  • [@ntdiary] Determine if we should create a regression test for this bug.
  • [@ntdiary] 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.
  • [@anmurali] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Polish
Development

No branches or pull requests

5 participants