Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.48k stars 2.83k forks source link

Header - Header does not display "No Action Required" when payment is disabled #50785

Open IuliiaHerets opened 3 days ago

IuliiaHerets commented 3 days ago

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.49-0 Reproducible in staging?: Y Reproducible in production?: Y Issue was found when executing this PR: https://github.com/Expensify/App/pull/49837 Email or phone of affected tester (no customers): biruknew45+1562@gmail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com.
  2. Navigate to Workspace and enable Workflows.
  3. Disable payments.
  4. Submit an expense in the workspace chat.
  5. Go offline and click on the expense preview.

Expected Result:

The header should display "No further action required."

Actual Result:

The header displays "Waiting for your expense(s) to automatically submit."

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/a3b7dd8b-9035-4d5a-8bc5-e2c01769fb2a

View all open jobs on GitHub

melvin-bot[bot] commented 3 days ago

Triggered auto assignment to @OfstadC (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 commented 3 days ago

@OfstadC 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

NJ-2020 commented 2 days ago

Edited by proposal-police: This proposal was edited at 2024-10-16 03:35:57 UTC.

Proposal

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

Header - Header does not display "No Action Required" when payment is disabled

What is the root cause of that problem?

When we create the next step header for the expense, we pass STATUS_NUM.OPEN for the predictedNextStatus https://github.com/Expensify/App/blob/f737e9b81bdf3b7b586f3d49ef6a9d07ba86620b/src/libs/actions/IOU.ts#L2170 https://github.com/Expensify/App/blob/f737e9b81bdf3b7b586f3d49ef6a9d07ba86620b/src/libs/NextStepUtils.ts#L112-L142

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

We should check if the policy?.reimbursementChoice is no CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO then we will pass STATUS_NUM.CLOSED

const optimisticNextStep = NextStepUtils.buildNextStep(
    iouReport,
    policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.OPEN,
);

Result

https://github.com/user-attachments/assets/a6ae7d83-3cb7-4862-a1a6-2f25e2891f62

What alternative solutions did you explore? (Optional)

We can also hide the next step header when the reimbursementChoice is no as the backend return empty next step when the reimbursementChoice is no

const optimisticNextStep = policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO ? null : NextStepUtils.buildNextStep(
    iouReport,
    CONST.REPORT.STATUS_NUM.OPEN,
);
OfstadC commented 2 days ago

Can't reproduce. I don't get a header at all

image image
OfstadC commented 2 days ago

Got in on the second try

image
daledah commented 2 days ago

Proposal

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

What is the root cause of that problem?

https://github.com/Expensify/App/blob/f737e9b81bdf3b7b586f3d49ef6a9d07ba86620b/src/libs/actions/IOU.ts#L2170

https://github.com/Expensify/App/blob/f737e9b81bdf3b7b586f3d49ef6a9d07ba86620b/src/libs/actions/IOU.ts#L2170

to:

    const optimisticNextStep = policy?.reimbursementChoice === 'reimburseNo' ? null : NextStepUtils.buildNextStep(iouReport, CONST.REPORT.STATUS_NUM.OPEN);

to make sure our optimistic data will match BE data.

What alternative solutions did you explore? (Optional)

{
    message: [],
    title: 'Next Step:',
    requiresUserAction: false,
    nextReceiver: '',
    showForExpense: true,
    showForMobile: true,
    showUndoSubmit: false
}
daledah commented 2 days ago

@OfstadC Can you confirm whether the expected behavior is: The header should display "No further action required."

Because, in online mode, there is no header is displayed.

NJ-2020 commented 2 days ago

Proposal Updated

abzokhattab commented 2 days ago

I think this is a regression from https://github.com/Expensify/App/pull/49837