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 2023-11-18] [$500] Deleting all workspaces does not remove red dot #29235

Closed
4 of 6 tasks
m-natarajan opened this issue Oct 10, 2023 · 35 comments
Closed
4 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Oct 10, 2023

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.3.80-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696933257327709

Action Performed:

  1. Open the app
  2. Open settings->workspaces->any workspace->bank account->connect manually
  3. Fill in step 1 and 2 details
  4. In step 3, fill in details and add any character in first name eg: 'test%%' (note that we are just doing this to trigger server error, it is not compulsory to trigger error only by this method)
  5. Click on Save & Continue and notice that it will trigger server side error
  6. Exit back to home page
  7. Click on settings->workspaces and delete all workspaces one by one
  8. Observe that even after deleting all workspaces, red dot is displayed on profile and besides workspaces in settings

Expected Result:

App should remove red dot of workspace error if we delete all the workspaces

Actual Result:

App displays red dot of workspace error even after we delete all the workspaces, it removes the red dot on relogin

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

Android: Native
Android: mWeb Chrome
android.chrome.red.dot.error.not.removed.after.workspace.delete.mp4
iOS: Native
iOS: mWeb Safari
ios.safari.red.dot.not.removed.after.workspace.delete.mov
MacOS: Chrome / Safari
mac.chrome.red.dot.not.dismissed.even.on.all.workspace.delete.mov
Red.dot.mp4
MacOS: Desktop
mac.desktop.red.dot.not.dismissed.even.on.all.workspace.delete.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013278e8038908746f
  • Upwork Job ID: 1711854514958786560
  • Last Price Increase: 2023-10-10
  • Automatic offers:
    • hoangzinh | Reviewer | 27222500
    • dukenv0307 | Contributor | 27222503
    • dhanashree-sawant | Reporter | 27222505
@m-natarajan m-natarajan added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 10, 2023
@melvin-bot melvin-bot bot changed the title Deleting all workspaces does not remove red dot [$500] Deleting all workspaces does not remove red dot Oct 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2023

Triggered auto assignment to @NicMendonca (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2023

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

@abzokhattab
Copy link
Contributor

abzokhattab commented Oct 10, 2023

Proposal

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

Deleting all workpsaces doesnt remove the red dot from the avatar and the settings workpsace tap

What is the root cause of that problem?

in this line we dont check if the current admin policies are empty or beside the reimbursementAccount.errors check

const policyBrickRoadIndicator =
!_.isEmpty(props.reimbursementAccount.errors) ||

same for the avatar indicator

() => !_.isEmpty(props.reimbursementAccount.errors),

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

Get the admin typed workspaces and check if they are empty or not beside reimbursementAccount.errors check

        const adminPolicies = _.chain(props.policies)
            .filter((policy) => policy && policy.type === CONST.POLICY.TYPE.FREE && policy.role === CONST.POLICY.ROLE.ADMIN)
            .value();

change the check to:

            (!_.isEmpty(props.reimbursementAccount.errors) && !_.isEmpty(adminPolicies)) ||

also in the indicator component we do the same ..

    const adminPolicies = _.chain(cleanPolicies)
        .filter((policy) => policy && policy.type === CONST.POLICY.TYPE.FREE && policy.role === CONST.POLICY.ROLE.ADMIN)
        .value();
        () => !_.isEmpty(adminPolicies) && !_.isEmpty(props.reimbursementAccount.errors),

POC

Screen.Recording.2023-10-11.at.1.30.13.AM.mov

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 11, 2023

Proposal

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

App displays red dot of workspace error even after we delete all the workspaces, it removes the red dot on relogin

What is the root cause of that problem?

We're not clearing the errors from the reimbursementAccount after all workspaces are deleted.

So the red dot will still show in the "Workspaces" in settings in this condition and still show in user avatar in this condition

The reimbursementAccount 's sole purpose is for the workspaces so we shouldn't retain red dot error for reimbursement account if we don't have any workspace.

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

In deleteWorkspace, if that's the only workspace left, we should clear the errors of the reimbursementAccount in Onyx in optimisticData (or we should clear all data in reimbursementAccount if that's also OK), and restore it in failureData. Since reimbursement account is related to workspace and it doesn't make sense to keep its errors (and data) after all workspaces are deleted.

What alternative solutions did you explore? (Optional)

NA

@abzokhattab
Copy link
Contributor

forgot to mention that by making those changes, whenever we create a new workspace again after we delete all of them, the red dot will be back again, which i think is the expected behavior.

@dukenv0307
Copy link
Contributor

Just IMO I'd be quite surprised if an error comes out of nowhere once I create a new workspace 😄

@hoangzinh
Copy link
Contributor

@abzokhattab @dukenv0307 I'm asking on slack here https://expensify.slack.com/archives/C01GTK53T8Q/p1697023569138709 Would love to hear your voice there. Thanks

@Charan-hs
Copy link
Contributor

@hoangzinh, hey from here it's mentioned that there is proper separation between workspace's bank account hence we should do the same thing in error also right? i.e. workspace's based error.

@hoangzinh
Copy link
Contributor

@hoangzinh, hey from here it's mentioned that there is proper separation between workspace's bank account hence we should do the same thing in error also right? i.e. workspace's based error.

@Charan-hs Sorry, I don't get it. Could you clarify it again? Thanks

@Charan-hs
Copy link
Contributor

@hoangzinh
Before this PR #24114, we stored a single bank detail for all workspaces but now we are storing separate bank details based on workspaces
For this Issue, we have to do the same here like each workspace will have its own error, which means an error object will store the workspace ID.

@hoangzinh
Copy link
Contributor

@Charan-hs The PR you mentioned is closed. It looks like we still keep the previous behavior, the bank account will shared for all workspaces.

@abzokhattab
Copy link
Contributor

What is the final verdict on here? which approach should we take? @hoangzinh

@hoangzinh
Copy link
Contributor

@abzokhattab According to discussion here https://expensify.slack.com/archives/C01GTK53T8Q/p1697045876921169?thread_ts=1697023569.138709&cid=C01GTK53T8Q

We're expecting the bank account's error will be cleared out completely once we delete all workspaces

@hoangzinh
Copy link
Contributor

@abzokhattab Thanks for your proposal #29235 (comment). But according to our expectation above #29235 (comment), your RCA is not totally correct, thus the solution won't solve the root cause.

@hoangzinh
Copy link
Contributor

@dukenv0307 Thanks for your proposal #29235 (comment). Your solution looks great. But can you add more details to your RCA? It's hard to understand why we not clearing the errors from the reimbursementAccount after all workspaces are deleted will cause this bug. Thanks

@dukenv0307
Copy link
Contributor

But can you add more details to your RCA?

Proposal updated to add more detailed RCA, thank you for the feedback!

@hoangzinh
Copy link
Contributor

@dukenv0307 thanks for updating. Your proposal has a correct RCA and also provided a solution that fits with our expectation here https://expensify.slack.com/archives/C01GTK53T8Q/p1697045876921169?thread_ts=1697023569.138709&cid=C01GTK53T8Q

Thus, I think we go with @dukenv0307's proposal #29235 (comment)

🎀👀🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 14, 2023

Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

📣 @hoangzinh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

📣 @dhanashree-sawant 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@luacmartins
Copy link
Contributor

Assigning @dukenv0307 to the issue!

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 17, 2023
@dukenv0307
Copy link
Contributor

@hoangzinh The PR is ready for review.

@hoangzinh
Copy link
Contributor

Hey team @dukenv0307 @luacmartins @NicMendonca , just wanna raise a recent change of Workspace bank account error here #27901 (comment). After that issue, our issue can not be reproduced anymore (because the Workspace bank account's error will be cleared when the user closes RHN). But It can be reproduced by another way as @dukenv0307 described in his PR #29781 (comment)

Close the tab and open app again

Just wanna discuss whether we should continue to fix this issue with those new steps

@luacmartins
Copy link
Contributor

@hoangzinh do we have a video of what that looks like? Might help with deciding if we should still fix this

@hoangzinh
Copy link
Contributor

sure. Those are recordings

Screen.Recording.2023-10-26.at.23.32.50.-.before.mov
Screen.Recording.2023-10-26.at.23.31.20.-.after.mov
Screen.Recording.2023-10-26.at.23.31.58.-.new.mov

@hoangzinh
Copy link
Contributor

cc @luacmartins @NicMendonca waiting for your thoughts on the comment above ^.

@luacmartins
Copy link
Contributor

Thanks for the videos @hoangzinh! Yea, I think we should still fix this.

@hoangzinh
Copy link
Contributor

hoangzinh commented Nov 18, 2023

It looks like Melvin didn't process the next step for this issue. The PR #29781 has been deployed to PROD 10/11/2023

Screenshot 2023-11-18 at 19 42 27

@hoangzinh
Copy link
Contributor

cc @NicMendonca @luacmartins

@luacmartins luacmartins changed the title [$500] Deleting all workspaces does not remove red dot [HOLD for payment 2023-11-18] [$500] Deleting all workspaces does not remove red dot Nov 19, 2023
@hoangzinh
Copy link
Contributor

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR: N/A. I think there is no PR directly causing this bug. It would be hard when we were implementing deleting a workspace, we also need to clear the workspace's bank account error. This issue is a kind of supplement to the logic we implemented previously.
  • 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: N/A
  • 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
  • Determine if we should create a regression test for this bug: ⛔ It's an edge case after PR fix blinking loader in connect bank account page #29260. This bug only occurs when the user closes/kills the App after saving Workspace's bank account.

@NicMendonca
Copy link
Contributor

omg, sorry, this didn't pop open as a daily for me to pay

@NicMendonca
Copy link
Contributor

Everyone has been paid via Upwork 🎉

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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants