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-08-19] [$250] Expense - Payment options displayed before submitting in thread created inside details page #41519

Closed
5 of 6 tasks
izarutskaya opened this issue May 2, 2024 · 75 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

@izarutskaya
Copy link

izarutskaya commented May 2, 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: 1.4.69-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4534255
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Create a workspace
  3. Open workspace chat
  4. Submit an expense
  5. Open expense details page
  6. Send a message
  7. Hover over the sent message and click on reply in thread

Expected Result:

The expense preview component inside the thread doesn't show options to pay the expense

Actual Result:

There are options to pay the expense on the expense preview component inside the thread and when clicked shows an RBR

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

Bug6468671_1714638988287.bandicam_2024-05-02_11-18-23-185.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01140896862273d9dc
  • Upwork Job ID: 1787962387841482752
  • Last Price Increase: 2024-05-21
  • Automatic offers:
    • kmbcook | Contributor | 102440887
Issue OwnerCurrent Issue Owner: @sakluger / @sakluger / @lschurr
Issue OwnerCurrent Issue Owner: @puneetlath / @sakluger / @lschurr
Issue OwnerCurrent Issue Owner: @puneetlath / @sakluger
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 2, 2024
Copy link

melvin-bot bot commented May 2, 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.

@izarutskaya
Copy link
Author

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

@cretadn22
Copy link
Contributor

Proposal

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

The wrong status on button

What is the root cause of that problem?

const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(chatReport);
const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport);

const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport);

The bug occurred because isOpenExpenseReport is false in these instances due to isPolicyExpenseChat also being false. isPolicyExpenseChat is false because we've used the wrong parameter for isPolicyExpenseChat function

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

Let's see the logic in the header

const isDraft = ReportUtils.isOpenExpenseReport(moneyRequestReport);

const shouldShowSubmitButton = isDraft && reimbursableSpend !== 0;

In the shouldShowSubmitButton, we don't include the isPolicyExpenseChat condition, which means we also should remove isPolicyExpenseChat condition from these places

const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport);

const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport);

What alternative solutions did you explore? (Optional)

If we prefer not to remove isPolicyExpenseChat in these places, we'll need to update it to use root parent report

    const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(chatReport));

Since the isPolicyExpenseChat function relies on the report.chatType field, which is only true when we use the root parent report

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.

@sakluger
Copy link
Contributor

sakluger commented May 3, 2024

I'm OOO today and Monday - assigning another BZ team member to help triage. I can take back over on Tuesday.

@sakluger sakluger removed their assignment May 3, 2024
@sakluger sakluger added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels May 3, 2024
Copy link

melvin-bot bot commented May 3, 2024

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

@sakluger sakluger assigned sakluger and unassigned miljakljajic May 3, 2024
@kmbcook
Copy link
Contributor

kmbcook commented May 3, 2024

Proposal

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

Payment options displayed before submitting in thread created inside details page

What is the root cause of that problem?

The root cause stems from #34640 where ReportUtils.getAllAncestorReportActions was written. That function returns an array of ancestors. The problem is that each ancestor in the array contains the incorrect report. The report action is correct, but the report is not; it is the report created by the action, but it should be the report containing the action.

ReportActionItemParentAction uses getAllAncestorReportActions to get ancestors.

setAllAncestors(ReportUtils.getAllAncestorReportActions(report));

setAllAncestors(ReportUtils.getAllAncestorReportActions(report));

ReportActionItemParentAction wraps ReportActionItem. ReportActionItem expects that its report prop is the same report which contains its action prop.

/** Report for this action */
report: OnyxTypes.Report;

/** All the data of the action item */
action: OnyxTypes.ReportAction;

ReportActionItem does not expect that its report prop is the report created by its action prop. If so, its action prop would be the parent report action of its report prop. But ReportActionItem already has a parentReportAction prop.

/** Report action belonging to the report's parent */
parentReportAction: OnyxEntry<OnyxTypes.ReportAction>;

Currently, props are being passed to ReportActionItem from ReportActionItemParentAction which do not conform to the above prop definitions.

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

Fix getAllAncestorReportActions so that each ancestor contains the correct report, the one that contains the report action. Below is the code which creates an ancestor.

App/src/libs/ReportUtils.ts

Lines 6171 to 6175 in 387ab0e

allAncestors.push({
report: currentReport,
reportAction: parentReportAction,
shouldDisplayNewMarker: isParentReportActionUnread,
});

Change to:
report: parentReport,

That way report will be the one which contains reportAction.

This change fixes the issue.

ReportActionItemParentAction is the only place where getAllAncestorReportActions is accessed.

Afterwards check to see if other follow-up changes are needed.

@melvin-bot melvin-bot bot added the Overdue label May 6, 2024
Copy link

melvin-bot bot commented May 7, 2024

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

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label May 7, 2024
@melvin-bot melvin-bot bot changed the title Expense - Payment options displayed before submitting in thread created inside details page [$250] Expense - Payment options displayed before submitting in thread created inside details page May 7, 2024
Copy link

melvin-bot bot commented May 7, 2024

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

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

melvin-bot bot commented May 7, 2024

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

@sakluger
Copy link
Contributor

Hey @thesahindia, could you please take a look at the proposals that have been posted so far?

@melvin-bot melvin-bot bot added the Overdue label May 13, 2024
Copy link

melvin-bot bot commented May 13, 2024

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

@sakluger
Copy link
Contributor

I'm going to re-assign another C+ to keep this one moving.

@kmbcook
Copy link
Contributor

kmbcook commented Jul 13, 2024

@rushatgabhane on staging.expenisfy.com I can start booking a flight, but then I get this error. (I am using this card number: 4242424242424242, which I saw in #43081)

Screenshot 2024-07-13 at 11 53 14 AM

@rushatgabhane
Copy link
Member

okay that should be working and you're able to access the travel website

@kmbcook
Copy link
Contributor

kmbcook commented Jul 14, 2024

I am able to move forward now. Thanks!

@kmbcook
Copy link
Contributor

kmbcook commented Jul 15, 2024

Moving this conversation back to the PR.

Copy link

melvin-bot bot commented Jul 23, 2024

@puneetlath, @sakluger, @kmbcook, @rushatgabhane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@kmbcook
Copy link
Contributor

kmbcook commented Jul 23, 2024

PR is being reviewed.

Copy link

melvin-bot bot commented Jul 31, 2024

@puneetlath, @sakluger, @kmbcook, @rushatgabhane Whoops! This issue is 2 days overdue. Let's get this updated quick!

@kmbcook
Copy link
Contributor

kmbcook commented Jul 31, 2024

PR is being reviewed.

@sakluger
Copy link
Contributor

sakluger commented Aug 5, 2024

PR is still being reviewed.

@sakluger
Copy link
Contributor

sakluger commented Aug 7, 2024

The PR was merged yesterday!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Aug 12, 2024
@melvin-bot melvin-bot bot changed the title [$250] Expense - Payment options displayed before submitting in thread created inside details page [HOLD for payment 2024-08-19] [$250] Expense - Payment options displayed before submitting in thread created inside details page Aug 12, 2024
Copy link

melvin-bot bot commented Aug 12, 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 Aug 12, 2024
Copy link

melvin-bot bot commented Aug 12, 2024

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

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

Copy link

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

  • [@rushatgabhane] The PR that introduced the bug has been identified. Link to the PR:
  • [@rushatgabhane] 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:
  • [@rushatgabhane] 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:
  • [@rushatgabhane] Determine if we should create a regression test for this bug.
  • [@rushatgabhane] 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.
  • [@sakluger] 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 Overdue and removed Weekly KSv2 labels Aug 18, 2024
@sakluger
Copy link
Contributor

Summarizing payment on this issue:

Contributor: @kmbcook $250, paid via Upwork
Contributor+: @rushatgabhane $250, please request on Newdot

@rushatgabhane please complete the BZ checklist.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 19, 2024
@rushatgabhane
Copy link
Member

rushatgabhane commented Aug 21, 2024

  1. The PR that introduced the bug has been identified. Link to the PR: Implement get all ancestor of the thread #34640

  2. 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/34640/files#r1725789269

  3. 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: N.A.

  4. Determine if we should create a regression test for this bug. - Yes

  5. 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 -

     1. Open workspace chat
     2. Submit an expense
     3. Open expense details page
     4. Send a message
     5. Hover over the sent message and click on reply in thread
     6. Verify that the expense preview component inside the thread doesn't show options to pay the expense
    

@sakluger
Copy link
Contributor

Thanks! I created the GH issue for new regression test steps.

@JmillsExpensify
Copy link

$250 approved for @rushatgabhane

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
No open projects
Archived in project
Development

No branches or pull requests