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

[$250] Expense Preview - RBR is still displayed after deleting workspace. #57273

Open
3 of 8 tasks
IuliiaHerets opened this issue Feb 22, 2025 · 6 comments
Open
3 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Feb 22, 2025

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: 9.1.4-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #57031
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Windows Windows 11 - Chrome, Samsung Galaxy A13 - Android 14, Wi-Fi, Chrome
App Component: Chat Report View

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Upgrade a workspace to Control Plan type
  3. Open a workspace chat
  4. Submit expenses with amount greater than 250
  5. Delete the workspace
  6. Go to the workspace chat.

Expected Result:

RBR should also disappear from the expense preview

Actual Result:

RBR is still shown in the expense preview of deleted expenses. it disappears after opening it.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6750516_1740184648199.bandicam_2025-02-22_03-36-27-332.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021894060604469383375
  • Upwork Job ID: 1894060604469383375
  • Last Price Increase: 2025-02-24
Issue OwnerCurrent Issue Owner: @sobitneupane
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 22, 2025
Copy link

melvin-bot bot commented Feb 22, 2025

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

@M00rish
Copy link
Contributor

M00rish commented Feb 22, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-02-22 13:49:57 UTC.

Proposal

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

Expense Preview - RBR is still displayed after deleting workspace

What is the root cause of that problem?

There is no check if policy is deleted or not to show RBR:

const shouldShowRBR = hasErrors && !iouSettled;

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

Add a check if policy is valid before checking errors:

    const shouldShowRBR = shouldShowPolicy(policy, isOffline, session?.email) && hasErrors && !iouSettled;

using shouldShowPolicy will deal with both offline and online cases, so the behavior is consistent,
or include it in hasErrors .

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

@thelullabyy
Copy link
Contributor

Proposal

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

  • RBR is still shown in the expense preview of deleted expenses. it disappears after opening it.

What is the root cause of that problem?

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

  • We can add isArchived check in:

hasViolations(iouReportID, violations, true) ||

        (hasViolations(iouReportID, violations, true) && !isArchived) ||

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

  • N / A

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

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

The RBR still presents on the report preview after deleting workspace.

What is the root cause of that problem?

The RBR shows in this case when there is a violation. When we delete a workspace, the violation is still there. When we open the IOU/expense report, the OpenReport clears the violation, so the RBR doesn't show anymore.

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

Optimistically remove the violation of any workspace expense report when the workspace is deleted.

reportsToArchive.forEach((report) => {
const {reportID, ownerAccountID} = report ?? {};
const isInvoiceReceiverReport = report?.invoiceReceiver && 'policyID' in report.invoiceReceiver && report.invoiceReceiver.policyID === policyID;
optimisticData.push({

if (report?.iouReportID) {
    const reportTransactions = ReportUtils.getReportTransactions(report.iouReportID);
    for (const transaction of reportTransactions) {
        const violations = allTransactionViolations?.[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction.transactionID}`];
        optimisticData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction.transactionID}`,
            value: null,
        });
        failureData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`,
            value: violations,
        });
    }
}

But from what I observed, if the violation is hold, it won't be removed from the BE. Hold violation type is warning, so I guess we can conditionally remove the violation with a type of violation only (or based on BE logic).

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We can test having a workspace and an expense report with an expense that has violation. When deleting the workspace, we need to assert that the violation is removed optimistically.

@melvin-bot melvin-bot bot added the Overdue label Feb 24, 2025
@maddylewis maddylewis added the External Added to denote the issue can be worked on by a contributor label Feb 24, 2025
@melvin-bot melvin-bot bot changed the title Expense Preview - RBR is still displayed after deleting workspace. [$250] Expense Preview - RBR is still displayed after deleting workspace. Feb 24, 2025
Copy link

melvin-bot bot commented Feb 24, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 24, 2025
Copy link

melvin-bot bot commented Feb 24, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Status: LOW
Development

No branches or pull requests

6 participants