Skip to content

Commit 620dda6

Browse files
committed
web: add delete data option for not logged in user
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
1 parent 09cba1a commit 620dda6

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

apps/web/src/dialogs/settings/profile-settings.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { EmailChangeDialog } from "../email-change-dialog";
3535
import { RecoveryKeyDialog } from "../recovery-key-dialog";
3636
import { UserProfile } from "./components/user-profile";
3737
import { SettingsGroup } from "./types";
38+
import Config from "../../utils/config";
3839

3940
export const ProfileSettings: SettingsGroup[] = [
4041
{
@@ -90,6 +91,37 @@ export const ProfileSettings: SettingsGroup[] = [
9091
}
9192
]
9293
},
94+
{
95+
key: "delete-data-for-not-logged-in-user",
96+
title: strings.deleteData(),
97+
description: strings.deleteAccountDesc(),
98+
keywords: [
99+
strings.deleteData(),
100+
strings.deleteAccount(),
101+
strings.clear()
102+
],
103+
isHidden: () => Boolean(useUserStore.getState().isLoggedIn),
104+
components: [
105+
{
106+
type: "button",
107+
variant: "error",
108+
title: strings.deleteData(),
109+
action: async () => {
110+
const ok = await ConfirmDialog.show({
111+
title: strings.deleteData(),
112+
message: strings.deleteAccountDesc(),
113+
positiveButtonText: strings.yes(),
114+
negativeButtonText: strings.no()
115+
});
116+
if (ok) {
117+
Config.clear();
118+
await db.reset();
119+
window.location.reload();
120+
}
121+
}
122+
}
123+
]
124+
},
93125
{
94126
key: "account-removal",
95127
title: strings.deleteAccount(),

packages/intl/locale/en.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,10 @@ msgstr "Delete collapsed section"
21292129
msgid "Delete column"
21302130
msgstr "Delete column"
21312131

2132+
#: src/strings.ts:2630
2133+
msgid "Delete data"
2134+
msgstr "Delete data"
2135+
21322136
#: src/strings.ts:1314
21332137
msgid "Delete group"
21342138
msgstr "Delete group"

packages/intl/locale/pseudo-LOCALE.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,6 +2118,10 @@ msgstr ""
21182118
msgid "Delete column"
21192119
msgstr ""
21202120

2121+
#: src/strings.ts:2630
2122+
msgid "Delete data"
2123+
msgstr ""
2124+
21212125
#: src/strings.ts:1314
21222126
msgid "Delete group"
21232127
msgstr ""

packages/intl/src/strings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2626,5 +2626,6 @@ Use this if changes from other devices are not appearing on this device. This wi
26262626
editCreationDate: () => t`Edit creation date`,
26272627
unlockIncomingNote: () => t`Unlock incoming note`,
26282628
unlockIncomingNoteDesc: () =>
2629-
t`The incoming note could not be unlocked with the provided password. Enter the correct password for the incoming note`
2629+
t`The incoming note could not be unlocked with the provided password. Enter the correct password for the incoming note`,
2630+
deleteData: () => t`Delete data`
26302631
};

0 commit comments

Comments
 (0)