From 7d179ef8b3b1078470c01eecd7b901e3f93751f3 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 11 Sep 2024 15:49:12 +1000 Subject: [PATCH] fix: unsend for legacy groups was broken --- .../conversations/unsendingInteractions.ts | 11 +++++++---- ts/util/accountManager.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ts/interactions/conversations/unsendingInteractions.ts b/ts/interactions/conversations/unsendingInteractions.ts index 9bac40394..d34d3747c 100644 --- a/ts/interactions/conversations/unsendingInteractions.ts +++ b/ts/interactions/conversations/unsendingInteractions.ts @@ -309,7 +309,6 @@ const doDeleteSelectedMessages = async ({ } // #region deletion for 1-1 and closed groups - if (deleteForEveryone) { if (!isAllOurs) { ToastUtils.pushMessageDeleteForbidden(); @@ -392,6 +391,7 @@ export async function deleteMessagesById(messageIds: Array, conversation const isMe = conversation.isMe(); const closeDialog = () => window.inboxStore?.dispatch(updateConfirmModal(null)); + const clearMessagesForEveryone = 'clearMessagesForEveryone'; window.inboxStore?.dispatch( updateConfirmModal({ @@ -399,8 +399,11 @@ export async function deleteMessagesById(messageIds: Array, conversation i18nMessage: { token: 'deleteMessage', args: { count: selectedMessages.length } }, radioOptions: !isMe ? [ - { label: window.i18n('clearMessagesForMe'), value: 'clearMessagesForMe' }, - { label: window.i18n('clearMessagesForEveryone'), value: 'clearMessagesForEveryone' }, + { label: window.i18n('clearMessagesForMe'), value: 'clearMessagesForMe' as const }, + { + label: window.i18n('clearMessagesForEveryone'), + value: clearMessagesForEveryone, + }, ] : undefined, okText: window.i18n('delete'), @@ -409,7 +412,7 @@ export async function deleteMessagesById(messageIds: Array, conversation await doDeleteSelectedMessages({ selectedMessages, conversation, - deleteForEveryone: args === 'deleteForEveryone', // chosenOption from radioOptions + deleteForEveryone: args === clearMessagesForEveryone, }); window.inboxStore?.dispatch(updateConfirmModal(null)); window.inboxStore?.dispatch(closeRightPanel()); diff --git a/ts/util/accountManager.ts b/ts/util/accountManager.ts index 10803e93a..32850bbd0 100644 --- a/ts/util/accountManager.ts +++ b/ts/util/accountManager.ts @@ -345,7 +345,7 @@ export async function deleteEverythingAndNetworkData() { title: window.i18n('clearDataAll'), i18nMessage: { token: 'clearDataErrorDescriptionGeneric' }, okTheme: SessionButtonColor.Danger, - okText: window.i18n('clearDeviceOnly'), + okText: window.i18n('clearDevice'), cancelText: window.i18n('cancel'), onClickOk: async () => { await deleteDbLocally();