From bde8cfaf6ce940e8cd4655bedeaac5ea22a1f347 Mon Sep 17 00:00:00 2001 From: truph01 Date: Fri, 27 Feb 2026 01:46:19 +0700 Subject: [PATCH 1/2] fix: can save vacation delegate that isn't associated with an account --- .../CustomStatus/VacationDelegatePage.tsx | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx b/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx index 803f08ef3e264..f7f4fd78310a0 100644 --- a/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx +++ b/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx @@ -1,5 +1,6 @@ import React, {useCallback} from 'react'; import BaseVacationDelegateSelectionComponent from '@components/BaseVacationDelegateSelectionComponent'; +import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; import {ModalActions} from '@components/Modal/Global/ModalContext'; import ScreenWrapper from '@components/ScreenWrapper'; import useConfirmModal from '@hooks/useConfirmModal'; @@ -21,6 +22,20 @@ function VacationDelegatePage() { const [vacationDelegate] = useOnyx(ONYXKEYS.NVP_PRIVATE_VACATION_DELEGATE); + const showErrorModal = useCallback( + async (message?: string) => { + await showConfirmModal({ + title: translate('common.headsUp'), + prompt: message ?? translate('statusPage.vacationDelegateError'), + confirmText: translate('common.buttonConfirm'), + shouldShowCancelButton: false, + }); + + clearVacationDelegateError(vacationDelegate?.previousDelegate); + }, + [showConfirmModal, translate, vacationDelegate?.previousDelegate], + ); + const showWarningModal = useCallback( async (delegateLogin: string) => { const result = await showConfirmModal({ @@ -56,6 +71,11 @@ function VacationDelegatePage() { return; } + if (response.jsonCode === CONST.JSON_CODE.EXP_ERROR) { + showErrorModal(response.message as string | undefined); + return; + } + if (response.jsonCode === CONST.JSON_CODE.POLICY_DIFF_WARNING) { showWarningModal(option?.login ?? ''); return; @@ -64,7 +84,7 @@ function VacationDelegatePage() { Navigation.goBack(ROUTES.SETTINGS_STATUS); }); }, - [currentUserLogin, vacationDelegate, showWarningModal], + [currentUserLogin, vacationDelegate, showWarningModal, showErrorModal], ); return ( @@ -72,14 +92,16 @@ function VacationDelegatePage() { includeSafeAreaPaddingBottom={false} testID="VacationDelegatePage" > - Navigation.goBack(ROUTES.SETTINGS_STATUS)} - cannotSetDelegateMessage={translate('statusPage.cannotSetVacationDelegate')} - includeCurrentUser={false} - /> + + Navigation.goBack(ROUTES.SETTINGS_STATUS)} + cannotSetDelegateMessage={translate('statusPage.cannotSetVacationDelegate')} + includeCurrentUser={false} + /> + ); } From a5e8c288f020becfa72390f987429b9d5fd60ab3 Mon Sep 17 00:00:00 2001 From: truph01 Date: Fri, 27 Feb 2026 02:01:35 +0700 Subject: [PATCH 2/2] fix: lint --- .../settings/Profile/CustomStatus/VacationDelegatePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx b/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx index f7f4fd78310a0..ac36c8d0d733f 100644 --- a/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx +++ b/src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx @@ -72,7 +72,7 @@ function VacationDelegatePage() { } if (response.jsonCode === CONST.JSON_CODE.EXP_ERROR) { - showErrorModal(response.message as string | undefined); + showErrorModal(response.message); return; }