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

[$1000] Web - 'Notify me' option doesn't update on Unavailable workspace #21859

Closed
1 of 6 tasks
kbecciv opened this issue Jun 29, 2023 · 25 comments
Closed
1 of 6 tasks

[$1000] Web - 'Notify me' option doesn't update on Unavailable workspace #21859

kbecciv opened this issue Jun 29, 2023 · 25 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering 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

@kbecciv
Copy link

kbecciv commented Jun 29, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to staging dot on web chrome and login with User A
  2. Create a new workspace and invite User B and click on the announce channel
  3. Login with User B on another web chrome and go to the announce channel
  4. Important step- Now close the browser for User B
  5. From User A, remove the User B from the workspace (members > remove User B)
  6. On user B, open the browser again so that User B is able to see 'Unavailable Workspace' on announce.
  7. From user B, go to 'Unavailable workspace' header and click on 'Notify me about messages' and try to select different options from there.
  8. Notice that even if you select other options, it switches back to the default option - Daily

Expected Result:

If settings can't be changed for unavailable workspace, we can either not show settings OR if we decide to show settings, then it should be updated if the user selects different options

Actual Result:

'Notify me' option doesn't update on the Unavailable workspace

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.33-4
Reproducible in staging?: y
Reproducible in production?: y
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
Notes/Photos/Videos: Any additional supporting documentation

Recording.3305.mp4
green-2023-06-28_11.41.43.mp4

Expensify/Expensify Issue URL:
Issue reported by: @priya-zha
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1687932409885299

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c0766bb586cb325f
  • Upwork Job ID: 1677141743908093952
  • Last Price Increase: 2023-07-07
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 29, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 29, 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

@StevenKKC
Copy link
Contributor

StevenKKC commented Jun 29, 2023

Proposal

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

'Notify me' option doesn't update on Unavailable workspace.

What is the root cause of that problem?

Once a user is removed from a workspace, he cannot update workspace notification settings, and the server will respond "Report no longer exists".
App does not check to see if the workspace is available, and the UI does not reflect the server's response.

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

The workspace details page can be blocked from being accessed by the removed user.
We can add a utility function ReportUtils.isAvailableWorkspace that checks if a workspace is available.

And in this line, we can check whether workspace is available using a utility function.

What alternative solutions did you explore? (Optional)

None.

@hungvu193
Copy link
Contributor

hungvu193 commented Jun 29, 2023

Proposal

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

Web - 'Notify me' option doesn't update on Unavailable workspace

What is the root cause of that problem?

We still receive information from a room that we aren't member from backend. This because if user didn't open the app when they didn't receive pusher event to remove announce report from their end.

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

In this case, we can update our canSeeDefaultRoom in here because it's used to filter our report in SidebarLinks also the current report to display

 const policy = allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
  // place this below isDomainRoom
    if (isChatRoom(report) && !policy) {
        return false;
    }

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added the Overdue label Jul 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 4, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

@adelekennedy 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@adelekennedy adelekennedy added the External Added to denote the issue can be worked on by a contributor label Jul 7, 2023
@melvin-bot melvin-bot bot changed the title Web - 'Notify me' option doesn't update on Unavailable workspace [$1000] Web - 'Notify me' option doesn't update on Unavailable workspace Jul 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

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

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

melvin-bot bot commented Jul 7, 2023

Current assignee @adelekennedy is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

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

@adelekennedy
Copy link

moving this along

@melvin-bot melvin-bot bot removed the Overdue label Jul 7, 2023
@jeet-dhandha
Copy link
Contributor

Proposal

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

  • User still able to see Workspace even when they were removed from the workspace.

What is the root cause of that problem?

  • The user didn't receive the Pusher's event as mentioned by @hungvu193. But still the shouldReportBeInOptionList should have handled this case.

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

  • First we need to change canSeeDefaultRoom and check if Policy for the report is still available or not. If not then we should remove the report (in this case it's room) from the list.
  • Second we need to add a check in canAccessReport to remove the user created rooms under that workspace too. As currently only the default room is removed.

What alternative solutions did you explore? (Optional)

  • N/A

@tienifr
Copy link
Contributor

tienifr commented Jul 8, 2023

Proposal

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

'Notify me' option doesn't update on the Unavailable workspace. Also the user can still see the workspace chat.

What is the root cause of that problem?

The above proposals have touched the surface of the root cause, however the issue is deeper than that.

This problem doesn't happen before, that's because earlier the OpenApp API is called whenever we load the page again. This will populate all the policies and reports data, and will not show stale data.

However, after this PR, we no longer call OpenApp on page load for performance reason (because OpenApp fetches all the data so it's slow), we only call ReconnectApp if the user was already logged in before.

After the user is removed from the workspace and the user loads the page, the ReconnectApp only sends back "set workspace to null", not "set reports and reportActions related to this workspace to null" (as the Pusher will send if the user opens the app at the time).

So that's the root cause. This not only happens when the the user is removed from the workspace and the user loads the page, it also happens when the user is re-added to the workspace and loads the page, the default chat reports will not show (because it's not sent back in ReconnectApp)

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

  1. We need to fix the back-end to return correct report and reportActions data in ReconnectApp for the following case:
  • The user is removed from the workspace and the user loads the page: should set report and reportActions of the workspace-related reports to null.
  • The user is re-added to the workspace and loads the page: should send workspace-related reports and reportActions data.
  1. For existing users which have incorrect data in Onyx due to this, and to be future-proof, we can add logic in
    function canAccessReport(report, policies, betas) {
    to return false if the report is associated to a workspace and that workspace is no longer available. This will work for both default rooms and user-created rooms.

What alternative solutions did you explore? (Optional)

In 2, another solution is in the Onyx.connect for policy data, if we see the policy is set to null, we'll remove the associated report data from Onyx.

@melvin-bot melvin-bot bot added the Overdue label Jul 10, 2023
@sobitneupane
Copy link
Contributor

I agree with @tienifr. It looks like something that should be fixed in backend. @adelekennedy Can we add an internal engineer to see if it can be fixed in backend as suggested here.

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
@tienifr
Copy link
Contributor

tienifr commented Jul 10, 2023

@sobitneupane I think we also need the front-end fix (2) mentioned in the proposal as well for existing users and also to prevent such issues occurring in the future.

What do you think?

@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

Triggered auto assignment to @NikkiWines (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@adelekennedy
Copy link

@NikkiWines question above - can thi be fixed on the backend as suggested here?

@adelekennedy
Copy link

Let's refocus this - after reproducing I don't think this is a true bug, when we remove someone from the workspace it doesn't matter that they can't update settings. I also wasn't able to reproduce the bug for re-added members 🤷‍♀️

I think we should actually close this as we're getting into backend fixes for something pretty insubstantial @NikkiWines @sobitneupane for thoughts

@NikkiWines
Copy link
Contributor

Yep, agreed - not saving user notification preferences for a workspace they don't have access to any longer sounds like expected behavior to me

@sobitneupane
Copy link
Contributor

IMO, those rooms from where user is removed should not be shown at all. It was the behavior previously and even now if user is removed when he/she is online, those rooms are not visible to the removed user.

According to @tienifr (#21859 (comment))

This problem doesn't happen before, that's because earlier the OpenApp API is called whenever we load the page again. This will populate all the policies and reports data, and will not show stale data.

However, after #18807, we no longer call OpenApp on page load for performance reason (because OpenApp fetches all the data so it's slow), we only call ReconnectApp if the user was already logged in before.

After the user is removed from the workspace and the user loads the page, the ReconnectApp only sends back "set workspace to null", not "set reports and reportActions related to this workspace to null" (as the Pusher will send if the user opens the app at the time).

@NikkiWines
Copy link
Contributor

If it's a regression from previous behavior (i.e. we used to not show the rooms but now we do) that sounds like an issue, and should be reported separately if it hasn't been already. But I don't think this issue as it was reported is a real bug

@adelekennedy
Copy link

Agree - I think we should open a separate issue and deal with the regression!

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

@NikkiWines @sobitneupane @adelekennedy this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@NikkiWines
Copy link
Contributor

Cool, in that case, I'm going to close this out. Thanks everyone 🙇

@tienifr
Copy link
Contributor

tienifr commented Jul 14, 2023

@NikkiWines @adelekennedy do you think we should modify the OP of this issue to reflect the correct behavior (not show the rooms) rather than create another issue for that?

@NikkiWines
Copy link
Contributor

@tienifr I personally think it should be a separately reported issue

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 Engineering 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
None yet
Development

No branches or pull requests

8 participants