diff --git a/ts/components/dialog/SessionConfirm.tsx b/ts/components/dialog/SessionConfirm.tsx index dfaabb24f..771c7f9be 100644 --- a/ts/components/dialog/SessionConfirm.tsx +++ b/ts/components/dialog/SessionConfirm.tsx @@ -32,8 +32,9 @@ export interface SessionConfirmDialogProps { /** * function to run on ok click. Closes modal after execution by default + * sometimes the callback might need arguments when using radioOptions */ - onClickOk?: () => Promise | void; + onClickOk?: (...args: Array) => Promise | void; onClickClose?: () => any; @@ -84,7 +85,7 @@ export const SessionConfirm = (props: SessionConfirmDialogProps) => { if (onClickOk) { setIsLoading(true); try { - await onClickOk(); + await onClickOk(chosenOption !== '' ? chosenOption : undefined); } catch (e) { window.log.warn(e); } finally { diff --git a/ts/interactions/conversations/unsendingInteractions.ts b/ts/interactions/conversations/unsendingInteractions.ts index d7d6e8369..84c062883 100644 --- a/ts/interactions/conversations/unsendingInteractions.ts +++ b/ts/interactions/conversations/unsendingInteractions.ts @@ -381,16 +381,16 @@ export async function deleteMessagesById(messageIds: Array, conversation ? window.i18n('deleteMessagesQuestion', [messageCount.toString()]) : window.i18n('deleteMessageQuestion'), radioOptions: [ - { label: window.i18n('deleteJustForMe'), value: window.i18n('deleteJustForMe') }, - { label: window.i18n('deleteForEveryone'), value: window.i18n('deleteForEveryone') }, + { label: window.i18n('deleteJustForMe'), value: 'deleteJustForMe' }, + { label: window.i18n('deleteForEveryone'), value: 'deleteForEveryone' }, ], okText: window.i18n('delete'), okTheme: SessionButtonColor.Danger, - onClickOk: async () => { + onClickOk: async args => { await doDeleteSelectedMessages({ selectedMessages, conversation, - deleteForEveryone: false, + deleteForEveryone: args === 'deleteForEveryone', // chosenOption from radioOptions }); window.inboxStore?.dispatch(updateConfirmModal(null)); },