diff --git a/src/libs/actions/PersonalDetails.ts b/src/libs/actions/PersonalDetails.ts index 589ac583020f..60aff19223bc 100644 --- a/src/libs/actions/PersonalDetails.ts +++ b/src/libs/actions/PersonalDetails.ts @@ -234,43 +234,6 @@ function updateSelectedTimezone(selectedTimezone: SelectedTimezone) { Navigation.goBack(ROUTES.SETTINGS_TIMEZONE); } -/** - * Fetches additional personal data like legal name, date of birth, address - */ -function openPersonalDetails() { - const optimisticData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, - value: { - isLoading: true, - }, - }, - ]; - - const successData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, - value: { - isLoading: false, - }, - }, - ]; - - const failureData: OnyxUpdate[] = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, - value: { - isLoading: false, - }, - }, - ]; - - API.read(READ_COMMANDS.OPEN_PERSONAL_DETAILS, {}, {optimisticData, successData, failureData}); -} - /** * Fetches public profile info about a given user. * The API will only return the accountID, displayName, and avatar for the user @@ -443,7 +406,6 @@ function clearAvatarErrors() { export { clearAvatarErrors, deleteAvatar, - openPersonalDetails, openPublicProfilePage, updateAddress, updateAutomaticTimezone, diff --git a/src/types/onyx/PrivatePersonalDetails.ts b/src/types/onyx/PrivatePersonalDetails.ts index 68199cf16e6e..3f0014bc96ff 100644 --- a/src/types/onyx/PrivatePersonalDetails.ts +++ b/src/types/onyx/PrivatePersonalDetails.ts @@ -20,9 +20,6 @@ type PrivatePersonalDetails = { /** User's home address */ address?: Address; - - /** Whether we are loading the data via the API */ - isLoading?: boolean; }; export default PrivatePersonalDetails; diff --git a/tests/unit/NetworkTest.ts b/tests/unit/NetworkTest.ts index 63b275a1a6b6..01689de89037 100644 --- a/tests/unit/NetworkTest.ts +++ b/tests/unit/NetworkTest.ts @@ -108,7 +108,7 @@ describe('NetworkTests', () => { HttpUtils.xhr = mockedXhr; // This should first trigger re-authentication and then a Failed to fetch - PersonalDetails.openPersonalDetails(); + PersonalDetails.openPublicProfilePage(TEST_USER_ACCOUNT_ID); return waitForBatchedUpdates() .then(() => Onyx.set(ONYXKEYS.NETWORK, {isOffline: false})) .then(() => { @@ -119,11 +119,11 @@ describe('NetworkTests', () => { return waitForBatchedUpdates(); }) .then(() => { - // Then we will eventually have 1 call to OpenPersonalDetailsPage and 1 calls to Authenticate - const callsToOpenPersonalDetails = (HttpUtils.xhr as Mock).mock.calls.filter(([command]) => command === 'OpenPersonalDetailsPage'); + // Then we will eventually have 1 call to OpenPublicProfilePage and 1 calls to Authenticate + const callsToOpenPublicProfilePage = (HttpUtils.xhr as Mock).mock.calls.filter(([command]) => command === 'OpenPublicProfilePage'); const callsToAuthenticate = (HttpUtils.xhr as Mock).mock.calls.filter(([command]) => command === 'Authenticate'); - expect(callsToOpenPersonalDetails.length).toBe(1); + expect(callsToOpenPublicProfilePage.length).toBe(1); expect(callsToAuthenticate.length).toBe(1); }); }); @@ -143,7 +143,7 @@ describe('NetworkTests', () => { const mockedXhr = jest.fn(); mockedXhr - // And mock the first call to openPersonalDetails return with an expired session code + // And mock the first call to openPublicProfilePage return with an expired session code .mockImplementationOnce(() => Promise.resolve({ jsonCode: CONST.JSON_CODE.NOT_AUTHENTICATED, @@ -176,17 +176,17 @@ describe('NetworkTests', () => { // And then make 3 API READ requests in quick succession with an expired authToken and handle the response // It doesn't matter which requests these are really as all the response is mocked we just want to see // that we get re-authenticated - PersonalDetails.openPersonalDetails(); - PersonalDetails.openPersonalDetails(); - PersonalDetails.openPersonalDetails(); + PersonalDetails.openPublicProfilePage(TEST_USER_ACCOUNT_ID); + PersonalDetails.openPublicProfilePage(TEST_USER_ACCOUNT_ID); + PersonalDetails.openPublicProfilePage(TEST_USER_ACCOUNT_ID); return waitForBatchedUpdates(); }) .then(() => { // We should expect to see the three calls to OpenApp, but only one call to Authenticate. // And we should also see the reconnection callbacks triggered. - const callsToOpenPersonalDetails = (HttpUtils.xhr as Mock).mock.calls.filter(([command]) => command === 'OpenPersonalDetailsPage'); + const callsToopenPublicProfilePage = (HttpUtils.xhr as Mock).mock.calls.filter(([command]) => command === 'OpenPublicProfilePage'); const callsToAuthenticate = (HttpUtils.xhr as Mock).mock.calls.filter(([command]) => command === 'Authenticate'); - expect(callsToOpenPersonalDetails.length).toBe(3); + expect(callsToopenPublicProfilePage.length).toBe(3); expect(callsToAuthenticate.length).toBe(1); expect(reconnectionCallbacksSpy.mock.calls.length).toBe(3); });