Skip to content

Commit

Permalink
fix access to WS overview (188)
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmydel committed Jan 30, 2024
1 parent 606b4cd commit 80dc8cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/pages/workspace/WorkspaceOverviewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function WorkspaceOverviewPage({policy, currencyList, route}) {
shouldShowLoading={false}
shouldUseScrollView
shouldShowOfflineIndicatorInWideScreen
shouldShowNonAdmin
>
{(hasVBA) => (
<>
Expand Down
10 changes: 6 additions & 4 deletions src/pages/workspace/WorkspacePageWithSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ type WorkspacePageWithSectionsProps = WithPolicyAndFullscreenLoadingProps &

shouldShowOfflineIndicatorInWideScreen?: boolean;

/** Whether to show this page to non admin policy members */
shouldShowNonAdmin?: boolean;

/** Policy values needed in the component */
policy: OnyxEntry<Policy>;
};
Expand Down Expand Up @@ -94,12 +97,12 @@ function WorkspacePageWithSections({
user,
shouldShowLoading = true,
shouldShowOfflineIndicatorInWideScreen = false,
shouldShowNonAdmin = false,
}: WorkspacePageWithSectionsProps) {
const styles = useThemeStyles();
useNetwork({onReconnect: () => fetchData(shouldSkipVBBACall)});

const isLoading = reimbursementAccount?.isLoading ?? true;
const isOverview = route.name;
const achState = reimbursementAccount?.achData?.state ?? '';
const isUsingECard = user?.isUsingExpensifyCard ?? false;
const policyID = route.params.policyID;
Expand All @@ -124,9 +127,8 @@ function WorkspacePageWithSections({
return true;
}

// TODO - check is the value of isOveriew is correct
return !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy) || !isOverview;
}, [isOverview, policy]);
return (!PolicyUtils.isPolicyAdmin(policy) && !shouldShowNonAdmin) || PolicyUtils.isPendingDeletePolicy(policy);
}, [shouldShowNonAdmin, policy]);

return (
<ScreenWrapper
Expand Down

0 comments on commit 80dc8cb

Please sign in to comment.