Page MenuHomePhabricator

D10062.id34195.diff
No OneTemporary

D10062.id34195.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
@@ -123,12 +123,12 @@
return useKeyserverCall(claimUsername);
}
-const deleteAccountActionTypes = Object.freeze({
- started: 'DELETE_ACCOUNT_STARTED',
- success: 'DELETE_ACCOUNT_SUCCESS',
- failed: 'DELETE_ACCOUNT_FAILED',
+const deleteKeyserverAccountActionTypes = Object.freeze({
+ started: 'DELETE_KEYSERVER_ACCOUNT_STARTED',
+ success: 'DELETE_KEYSERVER_ACCOUNT_SUCCESS',
+ failed: 'DELETE_KEYSERVER_ACCOUNT_FAILED',
});
-const deleteAccount =
+const deleteKeyserverAccount =
(
callKeyserverEndpoint: CallKeyserverEndpoint,
allKeyserverIDs: $ReadOnlyArray<string>,
@@ -143,10 +143,10 @@
return { currentUserInfo: loggedOutUserInfo, preRequestUserState };
};
-function useDeleteAccount(): (
+function useDeleteKeyserverAccount(): (
input: PreRequestUserState,
) => Promise<LogOutResult> {
- return useKeyserverCall(deleteAccount);
+ return useKeyserverCall(deleteKeyserverAccount);
}
const registerActionTypes = Object.freeze({
@@ -499,8 +499,8 @@
changeUserPassword,
claimUsernameActionTypes,
useClaimUsername,
- useDeleteAccount,
- deleteAccountActionTypes,
+ useDeleteKeyserverAccount,
+ deleteKeyserverAccountActionTypes,
getSessionPublicKeys,
getOlmSessionInitializationDataActionTypes,
getOlmSessionInitializationData,
diff --git a/lib/reducers/calendar-filters-reducer.js b/lib/reducers/calendar-filters-reducer.js
--- a/lib/reducers/calendar-filters-reducer.js
+++ b/lib/reducers/calendar-filters-reducer.js
@@ -13,7 +13,7 @@
} from '../actions/thread-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
registerActionTypes,
} from '../actions/user-actions.js';
@@ -55,7 +55,7 @@
): $ReadOnlyArray<CalendarFilter> {
if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
action.type === logInActionTypes.success ||
action.type === siweAuthActionTypes.success ||
action.type === registerActionTypes.success ||
diff --git a/lib/reducers/calendar-query-reducer.js b/lib/reducers/calendar-query-reducer.js
--- a/lib/reducers/calendar-query-reducer.js
+++ b/lib/reducers/calendar-query-reducer.js
@@ -4,7 +4,7 @@
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
registerActionTypes,
} from '../actions/user-actions.js';
@@ -24,7 +24,7 @@
): CalendarQuery {
if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/lib/reducers/data-loaded-reducer.js b/lib/reducers/data-loaded-reducer.js
--- a/lib/reducers/data-loaded-reducer.js
+++ b/lib/reducers/data-loaded-reducer.js
@@ -3,7 +3,7 @@
import { setDataLoadedActionType } from '../actions/client-db-store-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
} from '../actions/user-actions.js';
import type { BaseAction } from '../types/redux-types.js';
@@ -26,7 +26,7 @@
} else if (
action.type === logOutActionTypes.started ||
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
) {
return false;
}
diff --git a/lib/reducers/draft-reducer.js b/lib/reducers/draft-reducer.js
--- a/lib/reducers/draft-reducer.js
+++ b/lib/reducers/draft-reducer.js
@@ -6,7 +6,7 @@
updateDraftActionType,
} from '../actions/draft-actions.js';
import {
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logOutActionTypes,
} from '../actions/user-actions.js';
import type { DraftStore, DraftStoreOperation } from '../types/draft-types.js';
@@ -24,7 +24,7 @@
): ReduceDraftStoreResult {
if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/lib/reducers/enabled-apps-reducer.js b/lib/reducers/enabled-apps-reducer.js
--- a/lib/reducers/enabled-apps-reducer.js
+++ b/lib/reducers/enabled-apps-reducer.js
@@ -1,7 +1,7 @@
// @flow
import {
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logOutActionTypes,
} from '../actions/user-actions.js';
import type { EnabledApps } from '../types/enabled-apps.js';
@@ -28,7 +28,7 @@
return { ...state, calendar: false };
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js
--- a/lib/reducers/entry-reducer.js
+++ b/lib/reducers/entry-reducer.js
@@ -36,7 +36,7 @@
} from '../actions/thread-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
} from '../actions/user-actions.js';
import { entryID } from '../shared/entry-utils.js';
@@ -168,7 +168,7 @@
const { entryInfos, daysToEntries, lastUserInteractionCalendar } = entryStore;
if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
action.type === deleteThreadActionTypes.success ||
action.type === leaveThreadActionTypes.success
) {
@@ -178,7 +178,7 @@
)(entryInfos);
const newLastUserInteractionCalendar =
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
? 0
: lastUserInteractionCalendar;
if (Object.keys(newEntryInfos).length === Object.keys(entryInfos).length) {
diff --git a/lib/reducers/invite-links-reducer.js b/lib/reducers/invite-links-reducer.js
--- a/lib/reducers/invite-links-reducer.js
+++ b/lib/reducers/invite-links-reducer.js
@@ -6,7 +6,7 @@
fetchPrimaryInviteLinkActionTypes,
} from '../actions/link-actions.js';
import {
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logOutActionTypes,
} from '../actions/user-actions.js';
import type { InviteLinksStore, CommunityLinks } from '../types/link-types.js';
@@ -60,7 +60,7 @@
};
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/lib/reducers/keyserver-reducer.js b/lib/reducers/keyserver-reducer.js
--- a/lib/reducers/keyserver-reducer.js
+++ b/lib/reducers/keyserver-reducer.js
@@ -13,7 +13,7 @@
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
registerActionTypes,
logInActionTypes,
resetUserStateActionType,
@@ -297,7 +297,7 @@
};
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
) {
// We want to remove all keyservers but Ashoat's keyserver
const oldConnection = state.keyserverInfos[ashoatKeyserverID].connection;
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -48,7 +48,7 @@
import { updateMultimediaMessageMediaActionType } from '../actions/upload-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
registerActionTypes,
} from '../actions/user-actions.js';
@@ -826,7 +826,7 @@
);
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
action.type === deleteThreadActionTypes.success ||
action.type === leaveThreadActionTypes.success ||
action.type === setNewSessionActionType
diff --git a/lib/reducers/policies-reducer.js b/lib/reducers/policies-reducer.js
--- a/lib/reducers/policies-reducer.js
+++ b/lib/reducers/policies-reducer.js
@@ -2,7 +2,7 @@
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
logOutActionTypes,
policyAcknowledgmentActionTypes,
@@ -48,7 +48,7 @@
} else if (
action.type === logOutActionTypes.started ||
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
) {
return {};
}
diff --git a/lib/reducers/report-store-reducer.js b/lib/reducers/report-store-reducer.js
--- a/lib/reducers/report-store-reducer.js
+++ b/lib/reducers/report-store-reducer.js
@@ -9,7 +9,7 @@
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
} from '../actions/user-actions.js';
import type { ReportStoreOperation } from '../ops/report-store-ops.js';
@@ -75,7 +75,7 @@
};
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/lib/reducers/services-access-token-reducer.js b/lib/reducers/services-access-token-reducer.js
--- a/lib/reducers/services-access-token-reducer.js
+++ b/lib/reducers/services-access-token-reducer.js
@@ -2,7 +2,7 @@
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
setAccessTokenActionType,
} from '../actions/user-actions.js';
import type { BaseAction } from '../types/redux-types.js';
@@ -23,7 +23,7 @@
} else if (
action.type === logOutActionTypes.started ||
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
) {
return null;
}
diff --git a/lib/reducers/theme-reducer.js b/lib/reducers/theme-reducer.js
--- a/lib/reducers/theme-reducer.js
+++ b/lib/reducers/theme-reducer.js
@@ -4,7 +4,7 @@
import { updateThemeInfoActionType } from '../actions/theme-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
registerActionTypes,
} from '../actions/user-actions.js';
@@ -34,7 +34,7 @@
} else if (
action.type === logOutActionTypes.started ||
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
) {
return defaultGlobalThemeInfo;
} else if (action.type === updateThemeInfoActionType) {
diff --git a/lib/reducers/thread-activity-reducer.js b/lib/reducers/thread-activity-reducer.js
--- a/lib/reducers/thread-activity-reducer.js
+++ b/lib/reducers/thread-activity-reducer.js
@@ -16,7 +16,7 @@
} from '../actions/thread-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
} from '../actions/user-actions.js';
import type { BaseAction } from '../types/redux-types.js';
import { incrementalStateSyncActionType } from '../types/socket-types.js';
@@ -91,7 +91,7 @@
return updatedState;
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js
--- a/lib/reducers/thread-reducer.js
+++ b/lib/reducers/thread-reducer.js
@@ -20,7 +20,7 @@
} from '../actions/thread-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
registerActionTypes,
updateSubscriptionActionTypes,
@@ -108,7 +108,7 @@
};
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js
--- a/lib/reducers/user-reducer.js
+++ b/lib/reducers/user-reducer.js
@@ -11,7 +11,7 @@
} from '../actions/thread-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
registerActionTypes,
setUserSettingsActionTypes,
@@ -56,7 +56,7 @@
action.type === siweAuthActionTypes.success ||
action.type === registerActionTypes.success ||
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
) {
if (!_isEqual(action.payload.currentUserInfo)(state)) {
return action.payload.currentUserInfo;
@@ -211,7 +211,7 @@
}
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
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
@@ -213,18 +213,18 @@
+loadingInfo: LoadingInfo,
}
| {
- +type: 'DELETE_ACCOUNT_STARTED',
+ +type: 'DELETE_KEYSERVER_ACCOUNT_STARTED',
+payload?: void,
+loadingInfo: LoadingInfo,
}
| {
- +type: 'DELETE_ACCOUNT_FAILED',
+ +type: 'DELETE_KEYSERVER_ACCOUNT_FAILED',
+error: true,
+payload: Error,
+loadingInfo: LoadingInfo,
}
| {
- +type: 'DELETE_ACCOUNT_SUCCESS',
+ +type: 'DELETE_KEYSERVER_ACCOUNT_SUCCESS',
+payload: LogOutResult,
+loadingInfo: LoadingInfo,
}
diff --git a/native/profile/delete-account.react.js b/native/profile/delete-account.react.js
--- a/native/profile/delete-account.react.js
+++ b/native/profile/delete-account.react.js
@@ -5,8 +5,8 @@
import { ScrollView } from 'react-native-gesture-handler';
import {
- deleteAccountActionTypes,
- useDeleteAccount,
+ deleteKeyserverAccountActionTypes,
+ useDeleteKeyserverAccount,
} from 'lib/actions/user-actions.js';
import { preRequestUserStateSelector } from 'lib/selectors/account-selectors.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
@@ -21,7 +21,7 @@
import Alert from '../utils/alert.js';
const loadingStatusSelector = createLoadingStatusSelector(
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
);
type Props = {
@@ -35,7 +35,7 @@
const styles = useStyles(unboundStyles);
const dispatchActionPromise = useDispatchActionPromise();
- const callDeleteAccount = useDeleteAccount();
+ const callDeleteAccount = useDeleteKeyserverAccount();
const buttonContent =
loadingStatus === 'loading' ? (
@@ -62,7 +62,7 @@
}, [callDeleteAccount, preRequestUserState]);
const onDelete = React.useCallback(() => {
- dispatchActionPromise(deleteAccountActionTypes, deleteAction());
+ dispatchActionPromise(deleteKeyserverAccountActionTypes, deleteAction());
}, [dispatchActionPromise, deleteAction]);
return (
diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js
--- a/native/redux/redux-setup.js
+++ b/native/redux/redux-setup.js
@@ -9,7 +9,7 @@
import { siweAuthActionTypes } from 'lib/actions/siwe-actions.js';
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
logInActionTypes,
} from 'lib/actions/user-actions.js';
import type { ThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
@@ -117,7 +117,7 @@
action.payload.currentUserInfo,
action.payload.preRequestUserState,
)) ||
- (action.type === deleteAccountActionTypes.success &&
+ (action.type === deleteKeyserverAccountActionTypes.success &&
invalidSessionDowngrade(
state,
action.payload.currentUserInfo,
@@ -184,7 +184,7 @@
} else if (
action.type === logOutActionTypes.started ||
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
+ action.type === deleteKeyserverAccountActionTypes.success
) {
state = {
...state,
diff --git a/web/redux/crypto-store-reducer.js b/web/redux/crypto-store-reducer.js
--- a/web/redux/crypto-store-reducer.js
+++ b/web/redux/crypto-store-reducer.js
@@ -2,7 +2,7 @@
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
} from 'lib/actions/user-actions.js';
import type { CryptoStore } from 'lib/types/crypto-types.js';
import { setNewSessionActionType } from 'lib/utils/action-utils.js';
@@ -16,7 +16,7 @@
return action.payload;
} else if (
action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success ||
+ action.type === deleteKeyserverAccountActionTypes.success ||
(action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated)
) {
diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js
--- a/web/redux/redux-setup.js
+++ b/web/redux/redux-setup.js
@@ -5,7 +5,7 @@
import {
logOutActionTypes,
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
} from 'lib/actions/user-actions.js';
import {
type ThreadStoreOperation,
@@ -192,7 +192,7 @@
action.payload.currentUserInfo,
action.payload.preRequestUserState,
)) ||
- (action.type === deleteAccountActionTypes.success &&
+ (action.type === deleteKeyserverAccountActionTypes.success &&
invalidSessionDowngrade(
oldState,
action.payload.currentUserInfo,
diff --git a/web/settings/account-delete-modal.react.js b/web/settings/account-delete-modal.react.js
--- a/web/settings/account-delete-modal.react.js
+++ b/web/settings/account-delete-modal.react.js
@@ -3,8 +3,8 @@
import * as React from 'react';
import {
- useDeleteAccount,
- deleteAccountActionTypes,
+ useDeleteKeyserverAccount,
+ deleteKeyserverAccountActionTypes,
} from 'lib/actions/user-actions.js';
import { useModalContext } from 'lib/components/modal-provider.react.js';
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
@@ -18,7 +18,7 @@
import { useSelector } from '../redux/redux-utils.js';
const deleteAccountLoadingStatusSelector = createLoadingStatusSelector(
- deleteAccountActionTypes,
+ deleteKeyserverAccountActionTypes,
);
const AccountDeleteModal: React.ComponentType<{}> = React.memo<{}>(
@@ -27,7 +27,7 @@
const inputDisabled = useSelector(
state => deleteAccountLoadingStatusSelector(state) === 'loading',
);
- const callDeleteAccount = useDeleteAccount();
+ const callDeleteAccount = useDeleteKeyserverAccount();
const dispatchActionPromise = useDispatchActionPromise();
const { popModal } = useModalContext();
@@ -54,7 +54,10 @@
const onDelete = React.useCallback(
(event: SyntheticEvent<HTMLButtonElement>) => {
event.preventDefault();
- dispatchActionPromise(deleteAccountActionTypes, deleteAction());
+ dispatchActionPromise(
+ deleteKeyserverAccountActionTypes,
+ deleteAction(),
+ );
},
[dispatchActionPromise, deleteAction],
);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 5:02 AM (14 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2560022
Default Alt Text
D10062.id34195.diff (20 KB)

Event Timeline