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] Workspace - Workspace list doesn't get updated unless user opens workspace chat #46990

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 7, 2024 · 27 comments
Closed
1 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

@izarutskaya
Copy link

izarutskaya commented Aug 7, 2024

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.0.17-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Prepare two different devices as this issue needs two devices to reproduce
  2. (Device 1) Navigate to staging.new.expensify.com and sign in with a brand new account
  3. (Device 1) Create one new workspace
  4. (Device 1) Go to inbox and open your space chat
  5. (Device 1) Navigate back to workspace list page
  6. (Device 1) Stay on workspace list page
  7. (Device 2) Sign in with the same account as device 1
  8. (Device 2) Navigate to workspace list page
  9. (Device 2) Click on "New workspace" to create a new workspace
  10. (Device 1) while on the workspace list page refresh the page
  11. (Device 1) Observe that the new created workspace doesn't appear on the workspace list
  12. (Device 1) Go to inbox and observe the newly created workspace chat appearing on inbox (But do not open the workspace chat page yet
  13. Go back to workspace list page and observe the new workspace still didn't appear
  14. Go back to inbox and open the workspace chat of the newly created workspace
  15. Go back to the workspace list page

Expected Result:

The newly created workspace appears on the workspace list after it being created

Actual Result:

The newly created workspace does not appear on the workspace list page on device 1 unless user navigates to the newly created workspace chat and opens it and then navigates back to the workspace list page

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

Bug6552712_1721914886958.bandicam_2024-07-25_16-13-32-930.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0166c8776ce1f2455a
  • Upwork Job ID: 1825744773375033485
  • Last Price Increase: 2024-08-20
  • Automatic offers:
    • rayane-djouah | Reviewer | 103648162
Issue OwnerCurrent Issue Owner: @rayane-djouah
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

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

@RachCHopkins
Copy link
Contributor

Looks like the problem is:

Mac 1 creates an account and creates a workspace and stays on the Settings > Workspaces page
Mac 2 logs into that same account, creates an additional workspace
Mac 1 refreshes and cannot see the workspace immediately

We discourage users from sharing accounts, so I can't see that this is a real use bug, so there's no major urgency here.

@izarutskaya can I please confirm that I must use 2 macs, or is it any 2 devices?

@melvin-bot melvin-bot bot added the Overdue label Aug 12, 2024
Copy link

melvin-bot bot commented Aug 12, 2024

@RachCHopkins Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Aug 14, 2024

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

Copy link

melvin-bot bot commented Aug 16, 2024

@RachCHopkins Still overdue 6 days?! Let's take care of this!

@bernhardoj
Copy link
Contributor

Proposal

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

Workspace list doesn't get updated if we create the workspace from another device or OD.

What is the root cause of that problem?

When we create the workspace from another device or OD, the policy data doesn't have a role property, but shouldShowPolicy requires the policy to have a role, added in #44836.

App/src/libs/PolicyUtils.ts

Lines 169 to 175 in 67ad466

function shouldShowPolicy(policy: OnyxEntry<Policy>, isOffline: boolean): boolean {
return (
!!policy &&
(policy?.type !== CONST.POLICY.TYPE.PERSONAL || !!policy?.isJoinRequestPending) &&
(isOffline || policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.keys(policy.errors ?? {}).length > 0) &&
!!policy?.role
);

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

Even though the policy doesn't have a role property, it does have a employeeList which contains the employee list with each of its role. So, we can use that as a fallback, just like we did for isPolicyAdmin.

App/src/libs/PolicyUtils.ts

Lines 186 to 187 in 67ad466

const isPolicyAdmin = (policy: OnyxInputOrEntry<Policy>, currentUserLogin?: string): boolean =>
(policy?.role ?? (currentUserLogin && policy?.employeeList?.[currentUserLogin]?.role)) === CONST.POLICY.ROLE.ADMIN;

let currentUserLogin = '';
Onyx.connect({
    key: ONYXKEYS.SESSION,
    callback: (val) => {
        currentUserLogin = val?.email ?? '';
    },
});

(!!policy?.role || !!policy?.employeeList?.[currentUserLogin]?.role)

@bernhardoj
Copy link
Contributor

is it any 2 devices?

@RachCHopkins It's any 2 devices or creating the workspace from OD will cause this issue too. I once commented about this issue here.

@RachCHopkins RachCHopkins added the External Added to denote the issue can be worked on by a contributor label Aug 20, 2024
@melvin-bot melvin-bot bot changed the title Workspace - Workspace list doesn't get updated unless user opens workspace chat [$250] Workspace - Workspace list doesn't get updated unless user opens workspace chat Aug 20, 2024
Copy link

melvin-bot bot commented Aug 20, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 20, 2024
Copy link

melvin-bot bot commented Aug 20, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Aug 20, 2024
@RachCHopkins
Copy link
Contributor

Thanks @bernhardoj for the insight!

@rayane-djouah
Copy link
Contributor

Will review later today / tommorow

Copy link

melvin-bot bot commented Aug 21, 2024

@RachCHopkins @rayane-djouah 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!

@rayane-djouah
Copy link
Contributor

reviewing now 👀

@rayane-djouah
Copy link
Contributor

rayane-djouah commented Aug 21, 2024

I agree with @bernhardoj's proposal RCA and solution.

When we create the workspace from another device or from OD, the policy data doesn't have a role property:

Screen.Recording.2024-08-21.at.10.55.26.PM.mov

When we open the workspace chat of the newly created workspace, the policy data role property is populated:

Screen.Recording.2024-08-21.at.10.57.21.PM.mov

So, We need to use policy?.employeeList?.[currentUserLogin]?.role as a fallback in this case.

This is similar to what we've done in #42008

@rayane-djouah
Copy link
Contributor

@bernhardoj's proposal looks good to me.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 21, 2024

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

@lakchote
Copy link
Contributor

Thanks for reviewing @rayane-djouah,

@bernhardoj's proposal LGTM!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 23, 2024
Copy link

melvin-bot bot commented Aug 23, 2024

📣 @rayane-djouah 🎉 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

@bernhardoj
Copy link
Contributor

PR is ready

I cover #44697 in the PR too.

cc: @rayane-djouah

@RachCHopkins
Copy link
Contributor

How's the review going @rayane-djouah?

@rayane-djouah
Copy link
Contributor

rayane-djouah commented Sep 9, 2024

Note

The production deploy automation failed: This should be on [HOLD for Payment 2024-09-10] according to #48438 production deploy checklist, confirmed in #47958 (comment)

cc @RachCHopkins

@rayane-djouah
Copy link
Contributor

@RachCHopkins Payment is due today

@RachCHopkins
Copy link
Contributor

@rayane-djouah I've just paid you. @bernhardoj I will send you an offer shortly!

@RachCHopkins
Copy link
Contributor

Scratch that, sorry @bernhardoj I sent you an offer then retracted it, I just realised we pay you via NewDot.

Payment Summary:

Contributor: @bernhardoj to be paid $250 via NewDot Manual Request
Contributor+: @rayane-djouah paid $250 via Upwork
Upwork job here

@RachCHopkins
Copy link
Contributor

Contributor has been paid, the contract has been completed, and the Upwork post has been closed.

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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
No open projects
Status: Done
Development

No branches or pull requests

6 participants