Page MenuHomePhabricator

D10202.id34325.diff
No OneTemporary

D10202.id34325.diff

diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js
--- a/lib/actions/user-actions.js
+++ b/lib/actions/user-actions.js
@@ -18,6 +18,7 @@
UpdateUserAvatarResponse,
} from '../types/avatar-types.js';
import type { RawEntryInfo, CalendarQuery } from '../types/entry-types.js';
+import type { IdentityServiceClient } from '../types/identity-service-types';
import type {
RawMessageInfo,
MessageTruncationStatuses,
@@ -149,6 +150,24 @@
return useKeyserverCall(deleteKeyserverAccount);
}
+const deleteIdentityAccountActionTypes = Object.freeze({
+ started: 'DELETE_IDENTITY_ACCOUNT_STARTED',
+ success: 'DELETE_IDENTITY_ACCOUNT_SUCCESS',
+ failed: 'DELETE_IDENTITY_ACCOUNT_FAILED',
+});
+
+const deleteIdentityAccount = async (
+ client: IdentityServiceClient,
+): Promise<void> => {
+ await client.deleteUser();
+};
+
+function useDeleteIdentityAccount(
+ client: IdentityServiceClient,
+): () => Promise<void> {
+ return () => deleteIdentityAccount(client);
+}
+
const registerActionTypes = Object.freeze({
started: 'REGISTER_STARTED',
success: 'REGISTER_SUCCESS',
@@ -526,4 +545,6 @@
updateUserAvatar,
resetUserStateActionType,
setAccessTokenActionType,
+ deleteIdentityAccountActionTypes,
+ useDeleteIdentityAccount,
};
diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -18,3 +18,7 @@
+oneTimeContentPrekey: ?string,
+oneTimeNotifPrekey: ?string,
};
+
+export interface IdentityServiceClient {
+ deleteUser(): Promise<void>;
+}
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -229,6 +229,22 @@
+payload: LogOutResult,
+loadingInfo: LoadingInfo,
}
+ | {
+ +type: 'DELETE_IDENTITY_ACCOUNT_STARTED',
+ +payload?: void,
+ +loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'DELETE_IDENTITY_ACCOUNT_FAILED',
+ +error: true,
+ +payload: Error,
+ +loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'DELETE_IDENTITY_ACCOUNT_SUCCESS',
+ +payload: void,
+ +loadingInfo: LoadingInfo,
+ }
| {
+type: 'CREATE_LOCAL_ENTRY',
+payload: RawEntryInfo,

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 7, 12:13 AM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2251521
Default Alt Text
D10202.id34325.diff (2 KB)

Event Timeline