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.35k stars 2.78k forks source link

Invoice - Invoice room is not archived after deleting the workspace offline #49113

Open IuliiaHerets opened 2 weeks ago

IuliiaHerets commented 2 weeks 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.33-1 Reproducible in staging?: Y Reproducible in production?: Y Issue was found when executing this PR: https://github.com/Expensify/App/pull/48275 Email or phone of affected tester (no customers): applausetester+kh010901@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  1. Go to staging.new.expensify.com
  2. {User A] Send an invoice to User B.
  3. [User B] Pay the invoice using Pay as a business option.
  4. [User B] Go offline.
  5. [User B] Delete the workspace.
  6. {User B] Go to invoice chat.

Expected Result:

The invoice chat should be archived after deleting the workspace offline.

Actual Result:

The invoice room is not archived after deleting the workspace offline.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/e0fa69f8-afee-487e-b4c4-737ceae9df5a

Add any screenshot/video evidence

View all open jobs on GitHub

melvin-bot[bot] commented 2 weeks ago

Triggered auto assignment to @dylanexpensify (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 2 weeks ago

We think that this bug might be related to #vip-bills

IuliiaHerets commented 2 weeks ago

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

daledah commented 2 weeks ago

Proposal

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

The invoice room is not archived after deleting the workspace offline.

What is the root cause of that problem?

When deleting workspaces, we choose what report to be archived here: https://github.com/Expensify/App/blob/7748eff72fc43ecaf3db6159928d8d581a63ab99/src/libs/actions/Policy/Policy.ts#L312-L314

However, an invoice sent from user A will have policyID of A's WS, not of B's WS, so the condition report?.policyID === policyID is false, hence the chat room not archived.

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

We should add logic to include invoice chat sent from others as well, like what we did here

Update this:

https://github.com/Expensify/App/blob/7748eff72fc43ecaf3db6159928d8d581a63ab99/src/libs/actions/Policy/Policy.ts#L313

to:

(report) =>
            (report?.policyID === policyID || (report?.invoiceReceiver && 'policyID' in report?.invoiceReceiver && report?.invoiceReceiver.policyID == policyID)) &&
            (ReportUtils.isChatRoom(report) || ReportUtils.isPolicyExpenseChat(report) || ReportUtils.isTaskReport(report)),

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 1 week ago

@dylanexpensify Huh... This is 4 days overdue. Who can take care of this?

dylanexpensify commented 1 week ago

reviewing today!

melvin-bot[bot] commented 4 days ago

@dylanexpensify Eep! 4 days overdue now. Issues have feelings too...

dylanexpensify commented 2 days ago

@davidcardoza can you confirm if this is unexpected behavior?

davidcardoza commented 2 days ago

Do we archive workspace rooms after a workspace is delete? If yes, an invoice room should follow the same pattern.

melvin-bot[bot] commented 1 day ago

@dylanexpensify this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!