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.57k stars 2.91k forks source link

Expense - Amount in expense preview does not match the edited amount in deleted workspace #52896

Open izarutskaya opened 16 hours ago

izarutskaya commented 16 hours 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.65-1 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/5250638 Email or phone of affected tester (no customers): applausetester+kh0811004@applause.expensifail.com Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace.
  3. Go to workspace chat.
  4. Submit an expense.
  5. Delete the workspace.
  6. Go back to the workspace chat.
  7. Click on the expense preview.
  8. Click Amount.
  9. Edit the amount and save it.
  10. Go back to the main workspace chat.

Expected Result:

The amount in the expense preview in the main chat will match the edited amount.

Actual Result:

The amount in the expense preview in the main chat does not match the edited amount. This issue only happens when the workspace is deleted.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/34996898-d9a6-4bff-839e-17bc988d767f

View all open jobs on GitHub

melvin-bot[bot] commented 16 hours ago

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

huult commented 14 hours ago

Proposal

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

Amount in expense preview does not match the edited amount in deleted workspace

What is the root cause of that problem?

This is a backend issue. I say that because the total in the response is incorrect, so we display it incorrectly

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

I think, in this case, I must disable expenses to prevent updates when the workspace is archived, to avoid calculating the wrong value and incorrect logic. Some thing like this:

// src/components/ReportActionItem/MoneyRequestView.tsx#L438
+    const isArchivedRoom = ReportUtils.isArchivedRoomWithID(parentReport?.chatReportID);

// src/components/ReportActionItem/MoneyRequestView.tsx#L514
      <MenuItemWithTopDescription
          title={amountTitle}
          shouldShowTitleIcon={isSettled}
          titleIcon={Expensicons.Checkmark}
          description={amountDescription}
          titleStyle={styles.textHeadlineH2}
          interactive={canEditAmount}
          shouldShowRightIcon={canEditAmount}
          onPress={() =>
              Navigation.navigate(
                  ROUTES.MONEY_REQUEST_STEP_AMOUNT.getRoute(
                      CONST.IOU.ACTION.EDIT,
                      iouType,
                      transaction?.transactionID ?? '-1',
                      report?.reportID ?? '-1',
                      '',
                      Navigation.getReportRHPActiveRoute(),
                  ),
              )
          }
          brickRoadIndicator={getErrorForField('amount') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
          errorText={getErrorForField('amount')}
+          disabled={isArchivedRoom}
      />

We will do it like this for the description, date, and so on, if needed.

POC - Screenshot 2024-11-21 at 22 32 56

What alternative solutions did you explore? (Optional)