π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(DeleteAccount):fix-codex
Aswin Asok529d3253dbb0
diff --git a/desktop/changes/account-deletion-flow.md b/desktop/changes/account-deletion-flow.mdnew file mode 100644index 0000000000..604fa6a032--- /dev/null+++ b/desktop/changes/account-deletion-flow.md@@ -0,0 +1 @@+- Improved the account deletion flow with clearer steps and a summary of the data that will be deleted.diff --git a/web/apps/photos/src/components/DeleteAccount.tsx b/web/apps/photos/src/components/DeleteAccount.tsxindex cf7d30fa19..11b65bdd48 100644--- a/web/apps/photos/src/components/DeleteAccount.tsx+++ b/web/apps/photos/src/components/DeleteAccount.tsx@@ -46,7 +46,9 @@ import { t } from "i18next";import React, { useState } from "react";import { Trans } from "react-i18next";-type DeleteAccountProps = ModalVisibilityProps;+type DeleteAccountProps = ModalVisibilityProps & {+ onAuthenticateUser: () => Promise<void>;+};const surfaceRadius = "20px";const fieldRadius = "16px";@@ -75,6 +77,7 @@ const lightDisabledFill = "#eaeaea";export const DeleteAccount: React.FC<DeleteAccountProps> = ({open,onClose,+ onAuthenticateUser,}) => {const isSheet = useIsUploadSheet();@@ -98,14 +101,14 @@ export const DeleteAccount: React.FC<DeleteAccountProps> = ({},}}>- <DeleteAccountDialogContents {...{ onClose }} />+ <DeleteAccountDialogContents {...{ onClose, onAuthenticateUser }} /></Dialog>);};const DeleteAccountDialogContents: React.FC<Omit<DeleteAccountProps, "open">-> = ({ onClose }) => {+> = ({ onClose, onAuthenticateUser }) => {const { logout, showMiniDialog, onGenericError } = useBaseContext();const [step, setStep] = useState<"reason" | "confirmation">("reason");@@ -156,6 +159,7 @@ const DeleteAccountDialogContents: React.FC<await getAccountDeleteChallenge();if (allowDelete && encryptedChallenge) {+ await onAuthenticateUser();const decryptedChallenge =await decryptDeleteAccountChallenge(encryptedChallenge);await deleteAccount(diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsxindex d3d062b690..fb08c1bd9c 100644--- a/web/apps/photos/src/components/Sidebar.tsx+++ b/web/apps/photos/src/components/Sidebar.tsx@@ -948,7 +948,7 @@ const Account: React.FC<AccountProps> = ({pendingAction,onActionHandled,}) => {- const { showMiniDialog, onGenericError } = useBaseContext();+ const { showMiniDialog } = useBaseContext();const userDetails = useUserDetailsSnapshot();const router = useRouter();@@ -1033,14 +1033,9 @@ const Account: React.FC<AccountProps> = ({showSessions();}, [onAuthenticateUser, showSessions]);- const handleDeleteAccount = useCallback(async () => {- try {- await onAuthenticateUser();- showDeleteAccount();- } catch (error) {- if (!isReauthenticationCancellation(error)) onGenericError(error);- }- }, [onAuthenticateUser, onGenericError, showDeleteAccount]);+ const handleDeleteAccount = useCallback(() => {+ showDeleteAccount();+ }, [showDeleteAccount]);useEffect(() => {if (!open || !pendingAction) return;@@ -1065,7 +1060,7 @@ const Account: React.FC<AccountProps> = ({handleChangeEmail();break;case "account.deleteAccount":- void handleDeleteAccount();+ handleDeleteAccount();break;case "account.sessions":void handleActiveSessions();@@ -1133,7 +1128,7 @@ const Account: React.FC<AccountProps> = ({<RowButtoncolor="critical"label={t("delete_account")}- onClick={() => void handleDeleteAccount()}+ onClick={handleDeleteAccount}/></RowButtonGroup></Stack>@@ -1155,7 +1150,10 @@ const Account: React.FC<AccountProps> = ({{...sessionsVisibilityProps}onRootClose={onRootClose}/>- <DeleteAccount {...deleteAccountVisibilityProps} />+ <DeleteAccount+ {...deleteAccountVisibilityProps}+ {...{ onAuthenticateUser }}+ /></TitledNestedSidebarDrawer>);};