Skip to content

Commit daebac7

Browse files
Addressed suggestion
1 parent 029ec46 commit daebac7

4 files changed

Lines changed: 5 additions & 19 deletions

File tree

src/libs/actions/User.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,9 +1452,9 @@ function lockAccount(accountID?: number, domainAccountID?: number, domainName?:
14521452
return API.makeRequestWithSideEffects(SIDE_EFFECT_REQUEST_COMMANDS.LOCK_ACCOUNT, params, {optimisticData, successData, failureData});
14531453
}
14541454

1455-
function requestUnlockAccount(currentAccountIDParam: number, accountID: number | undefined) {
1455+
function requestUnlockAccount(accountID: number) {
14561456
const params: LockAccountParams = {
1457-
accountID: accountID ?? currentAccountIDParam,
1457+
accountID,
14581458
};
14591459

14601460
API.write(WRITE_COMMANDS.REQUEST_UNLOCK_ACCOUNT, params);

src/pages/domain/Members/DomainMemberDetailsPage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import MenuItem from '@components/MenuItem';
1010
import {ModalActions} from '@components/Modal/Global/ModalContext';
1111
import VacationDelegateMenuItem from '@components/VacationDelegateMenuItem';
1212
import useConfirmModal from '@hooks/useConfirmModal';
13-
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
1413
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
1514
import useLocalize from '@hooks/useLocalize';
1615
import useOnyx from '@hooks/useOnyx';
@@ -37,7 +36,6 @@ function DomainMemberDetailsPage({route}: DomainMemberDetailsPageProps) {
3736
const {domainAccountID, accountID} = route.params;
3837
const styles = useThemeStyles();
3938
const {translate} = useLocalize();
40-
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
4139
const icons = useMemoizedLazyExpensifyIcons(['RemoveMembers', 'Flag', 'Unlock', 'CircularArrowBackwards']);
4240
const [isModalVisible, setIsModalVisible] = useState(false);
4341
const [shouldForceCloseAccount, setShouldForceCloseAccount] = useState<boolean>();
@@ -121,7 +119,7 @@ function DomainMemberDetailsPage({route}: DomainMemberDetailsPageProps) {
121119
);
122120

123121
const showUnlockAccountModal = () => {
124-
requestUnlockAccount(currentUserPersonalDetails.accountID, accountID);
122+
requestUnlockAccount(accountID);
125123
showConfirmModal({
126124
title: translate('lockAccountPage.unlockTitle'),
127125
prompt: translate('lockAccountPage.unlockDescription'),

src/pages/settings/Security/LockAccount/UnlockAccountPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function UnlockAccountPage() {
3535
descriptionStyle={styles.colorMuted}
3636
buttonText={translate('unlockAccountPage.chatWithConcierge')}
3737
onButtonPress={() => {
38-
requestUnlockAccount(currentUserPersonalDetails.accountID, undefined);
38+
requestUnlockAccount(currentUserPersonalDetails.accountID);
3939
Navigation.navigate(ROUTES.CONCIERGE);
4040
}}
4141
containerStyle={styles.h100}

tests/actions/UserTest.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -792,24 +792,12 @@ describe('actions/User', () => {
792792

793793
describe('requestUnlockAccount', () => {
794794
it('should call API.write with REQUEST_UNLOCK_ACCOUNT command and explicit accountID', async () => {
795-
const currentAccountID = 888;
796795
const accountID = 123456;
797-
UserActions.requestUnlockAccount(currentAccountID, accountID);
796+
UserActions.requestUnlockAccount(accountID);
798797
await waitForBatchedUpdates();
799798

800799
expect(mockAPI.write).toHaveBeenCalledWith(WRITE_COMMANDS.REQUEST_UNLOCK_ACCOUNT, {accountID});
801800
});
802-
803-
it('should fall back to currentUserAccountID when no accountID is provided', async () => {
804-
const currentAccountID = 888;
805-
await Onyx.merge(ONYXKEYS.SESSION, {accountID: currentAccountID, email: 'user@expensify.com'});
806-
await waitForBatchedUpdates();
807-
808-
UserActions.requestUnlockAccount(currentAccountID, undefined);
809-
await waitForBatchedUpdates();
810-
811-
expect(mockAPI.write).toHaveBeenCalledWith(WRITE_COMMANDS.REQUEST_UNLOCK_ACCOUNT, {accountID: currentAccountID});
812-
});
813801
});
814802

815803
describe('respondToProactiveAppReview', () => {

0 commit comments

Comments
 (0)