From 26fa14dd02a28687bf2354c6eded1339949c8cbe Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 27 Jun 2024 14:59:26 +0800 Subject: [PATCH 1/2] clear the policy when leaving --- src/libs/actions/Policy/Policy.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index d1326ee8f733..0ff65daa7e5b 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -606,12 +606,7 @@ function leaveWorkspace(policyID: string) { { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, - value: { - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, - employeeList: { - [sessionEmail]: null, - }, - }, + value: null, }, ]; const failureData: OnyxUpdate[] = [ From 4746775d44c95be8570c6171a98fd45edc6349e3 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 27 Jun 2024 15:00:05 +0800 Subject: [PATCH 2/2] reiinvite user if policy is pending delete --- src/pages/workspace/WorkspaceJoinUserPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/WorkspaceJoinUserPage.tsx b/src/pages/workspace/WorkspaceJoinUserPage.tsx index e14fda8753c9..d73dab51c4fe 100644 --- a/src/pages/workspace/WorkspaceJoinUserPage.tsx +++ b/src/pages/workspace/WorkspaceJoinUserPage.tsx @@ -6,6 +6,7 @@ import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import ScreenWrapper from '@components/ScreenWrapper'; import useThemeStyles from '@hooks/useThemeStyles'; import navigateAfterJoinRequest from '@libs/navigateAfterJoinRequest'; +import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {AuthScreensParamList} from '@navigation/types'; import * as MemberAction from '@userActions/Policy/Member'; @@ -42,7 +43,7 @@ function WorkspaceJoinUserPage({route, policy}: WorkspaceJoinUserPageProps) { if (isUnmounted.current || isJoinLinkUsed) { return; } - if (!isEmptyObject(policy) && !policy?.isJoinRequestPending) { + if (!isEmptyObject(policy) && !policy?.isJoinRequestPending && !PolicyUtils.isPendingDeletePolicy(policy)) { Navigation.isNavigationReady().then(() => { Navigation.goBack(undefined, false, true); Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID ?? '-1'));