Skip to content

Commit

Permalink
Merge pull request Expensify#52171 from nkdengineer/fix/51616
Browse files Browse the repository at this point in the history
fix remove new workspace option from FAB when user is in a workspace
  • Loading branch information
Julesssss authored Nov 12, 2024
2 parents f906450 + aa41664 commit cd3f30f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import variables from '@styles/variables';
import * as App from '@userActions/App';
import * as IOU from '@userActions/IOU';
import * as Link from '@userActions/Link';
import * as Policy from '@userActions/Policy/Policy';
import * as Report from '@userActions/Report';
import * as Task from '@userActions/Task';
import * as Welcome from '@userActions/Welcome';
Expand Down Expand Up @@ -198,6 +197,10 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
return !groupPolicies.some((policy) => !!policy?.isPolicyExpenseChatEnabled);
}, [allPolicies]);

const shouldShowNewWorkspaceButton = Object.values(allPolicies ?? {}).every(
(policy) => !PolicyUtils.shouldShowPolicy(policy as OnyxEntry<OnyxTypes.Policy>, !!isOffline, session?.email),
);

const quickActionAvatars = useMemo(() => {
if (quickActionReport) {
const avatars = ReportUtils.getIcons(quickActionReport, personalDetails);
Expand Down Expand Up @@ -565,7 +568,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
},
]
: []),
...(!isLoading && !Policy.hasActiveChatEnabledPolicies(allPolicies)
...(!isLoading && shouldShowNewWorkspaceButton
? [
{
displayInDefaultIconColor: true,
Expand Down

0 comments on commit cd3f30f

Please sign in to comment.