From f81767e8c2f93012dc0c41d41f3715b2e317bb65 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 10 Sep 2024 10:57:07 +1000 Subject: [PATCH] feat: display generic error for delete account warning --- ts/util/accountManager.ts | 40 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/ts/util/accountManager.ts b/ts/util/accountManager.ts index 712b5cec3..10803e93a 100644 --- a/ts/util/accountManager.ts +++ b/ts/util/accountManager.ts @@ -326,47 +326,27 @@ export async function deleteEverythingAndNetworkData() { // send deletion message to the network const potentiallyMaliciousSnodes = await SnodeAPI.forceNetworkDeletion(); - if (potentiallyMaliciousSnodes === null) { + if (potentiallyMaliciousSnodes === null || potentiallyMaliciousSnodes.length) { window?.log?.warn('DeleteAccount => forceNetworkDeletion failed'); - // close this dialog - window?.inboxStore?.dispatch(updateDeleteAccountModal(null)); - window?.inboxStore?.dispatch( - updateConfirmModal({ - title: window.i18n('clearDataAll'), - i18nMessage: { token: 'clearDataErrorDescriptionGeneric' }, - okTheme: SessionButtonColor.Danger, - okText: window.i18n('clearDevice'), - onClickOk: async () => { - await deleteDbLocally(); - window.restart(); - }, - onClickClose: () => { - window.inboxStore?.dispatch(updateConfirmModal(null)); - }, - }) - ); - return; - } + if (potentiallyMaliciousSnodes?.length) { + const snodeStr = potentiallyMaliciousSnodes.map(ed25519Str); + window?.log?.warn( + 'DeleteAccount => forceNetworkDeletion Got some potentially malicious snodes', + snodeStr + ); + } - if (potentiallyMaliciousSnodes.length) { - const snodeStr = potentiallyMaliciousSnodes.map(ed25519Str); - window?.log?.warn( - 'DeleteAccount => forceNetworkDeletion Got some potentially malicious snodes', - snodeStr - ); // close this dialog window?.inboxStore?.dispatch(updateDeleteAccountModal(null)); // open a new confirm dialog to ask user what to do window?.inboxStore?.dispatch( updateConfirmModal({ title: window.i18n('clearDataAll'), - i18nMessage: { - token: 'clearDataErrorDescriptionGeneric', - }, - i18nMessageSub: { token: 'clearDeviceAndNetworkConfirm' }, + i18nMessage: { token: 'clearDataErrorDescriptionGeneric' }, okTheme: SessionButtonColor.Danger, okText: window.i18n('clearDeviceOnly'), + cancelText: window.i18n('cancel'), onClickOk: async () => { await deleteDbLocally(); window.restart();