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

Room - 'No workspace found' page is not displayed when user navigates to room #34253

Closed
6 tasks done
lanitochka17 opened this issue Jan 10, 2024 · 15 comments
Closed
6 tasks done
Assignees

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 10, 2024

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: 1.4.24-0
Reproducible in staging?: Y
Reproducible in production?: N
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: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Sign up with a new account & verify that you are not a member of any workspace
  2. Click on 'FAB' menu > click on 'Start Chat'
  3. Click on 'Room'

Expected Result:

'No workspace found' page should be displayed

Actual Result:

User is navigated to 'Create room' page but is unable to create. a room

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

Add any screenshot/video evidence

Bug6337845_1704901616647.Screen_Recording_2024-01-10_at_2.55.02_in_the_afternoon__1_.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Jan 10, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Jan 10, 2024

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

@paultsimura
Copy link
Contributor

paultsimura commented Jan 10, 2024

Proposal

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

What is the root cause of that problem?

The default "{user}'s Expenses" workspace is now present in Onyx for the newly created users:

image

And it is not filtered out when building the list of workspaces available for room creation.

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

If we don't want to allow to create rooms in it, we should filter out the default "{user}'s Expenses" workspace here:

const workspaceOptions = useMemo(
() =>
_.map(PolicyUtils.getActivePolicies(props.policies), (policy) => ({
label: policy.name,
key: policy.id,
value: policy.id,
})),
[props.policies],
);

Similar to how we decide whether the Policy should be present in the User's policies list:

/**
* Check if the policy can be displayed
* If offline, always show the policy pending deletion.
* If online, show the policy pending deletion only if there is an error.
* Note: Using a local ONYXKEYS.NETWORK subscription will cause a delay in
* updating the screen. Passing the offline status from the component.
*/
function shouldShowPolicy(policy: OnyxEntry<Policy>, isOffline: boolean): boolean {
return (
!!policy &&
policy?.isPolicyExpenseChatEnabled &&
policy?.role === CONST.POLICY.ROLE.ADMIN &&
(isOffline || policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.keys(policy.errors ?? {}).length > 0)
);
}

What alternative solutions did you explore? (Optional)

We can partially revert de0a96b by bringing back the policy.isPolicyExpenseChatEnabled check into getActivePolicies function.

@dukenv0307
Copy link
Contributor

Proposal

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

User is navigated to 'Create room' page but is unable to create. a room

What is the root cause of that problem?

BE returns the default policy of the user. So the workspace option is not empty here

_.map(PolicyUtils.getActivePolicies(props.policies), (policy) => ({

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

If we only want to create a room for the workspace which is displayed in WorkspaceListPage, we can use PolicyUtils.shouldShowPolicy to filter out the workspace options here. This will be consistent with the list workspaces which we show in the WorkspaceListPage

_.map(PolicyUtils.getActivePolicies(props.policies), (policy) => ({

What alternative solutions did you explore? (Optional)

NA

@paultsimura
Copy link
Contributor

BTW, this is a regression from #34046
cc: @iwiznia

@iwiznia
Copy link
Contributor

iwiznia commented Jan 10, 2024

Huh? Why/how? Ohhhhh, is it because we are not creating the chats for the admin? Basically what @Julesssss pointed out here?

@paultsimura
Copy link
Contributor

paultsimura commented Jan 10, 2024

Yes. We should have kept the policy.isPolicyExpenseChatEnabled check here:

image

We are still keeping this check when deciding whether the Workspace should be visible on Profile -> Workspaces page:

/**
* Check if the policy can be displayed
* If offline, always show the policy pending deletion.
* If online, show the policy pending deletion only if there is an error.
* Note: Using a local ONYXKEYS.NETWORK subscription will cause a delay in
* updating the screen. Passing the offline status from the component.
*/
function shouldShowPolicy(policy: OnyxEntry<Policy>, isOffline: boolean): boolean {
return (
!!policy &&
policy?.isPolicyExpenseChatEnabled &&
policy?.role === CONST.POLICY.ROLE.ADMIN &&
(isOffline || policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.keys(policy.errors ?? {}).length > 0)
);
}

@iwiznia
Copy link
Contributor

iwiznia commented Jan 10, 2024

Well that kind of defeats the purpose of the PR... I think we need to do what @Julesssss suggested in the backend, but waiting for him to double check.

@Julesssss
Copy link
Contributor

I think you mean @mountiny.

Just noting that the UI issue reminds me of this bug.

@iwiznia
Copy link
Contributor

iwiznia commented Jan 10, 2024

Damnit! Sorry about that. I swear it's your avatars, they look too similar for my shitty ill working eyes 😂

@cead22
Copy link
Contributor

cead22 commented Jan 11, 2024

Looks like we're waiting on Vit to confirm, and this might need a backend fix. @iwiznia I assigned you since you'll be on before me tomorrow, and you seem to be familiar with this issue

@thienlnam
Copy link
Contributor

thienlnam commented Jan 11, 2024

Should we revert that PR for the meantime so we can continue with deploy? Seems like reverting will just require you to create a workspace and that works as intended - so seems like we should go with that for now and then we can figure out what changes are required later

@thienlnam
Copy link
Contributor

Ended up reverting it #34311 - which actually ended up overlapping with another TS change that was merged to main that I fixed here

@thienlnam thienlnam added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Jan 11, 2024
@iwiznia
Copy link
Contributor

iwiznia commented Jan 11, 2024

So can we close this now that it was reverted?

@thienlnam
Copy link
Contributor

Yeah, we can close this since this bug no longer exists and then move the convo to the original issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants