From 15afdbfa7d716d61acfa993af7fa7e0e7a3b7137 Mon Sep 17 00:00:00 2001 From: Warrick Corfe-Tan Date: Fri, 18 Jun 2021 16:28:24 +1000 Subject: [PATCH] Link preview confirmation dialog working. --- ts/components/session/SessionConfirm.tsx | 18 +++--------------- .../conversation/SessionCompositionBox.tsx | 3 +++ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/ts/components/session/SessionConfirm.tsx b/ts/components/session/SessionConfirm.tsx index 62f55c0d9..606a26f05 100644 --- a/ts/components/session/SessionConfirm.tsx +++ b/ts/components/session/SessionConfirm.tsx @@ -39,12 +39,10 @@ const SessionConfirmInner = (props: SessionConfirmDialogProps) => { closeTheme = SessionButtonColor.Primary, onClickOk, onClickClose, - closeAfterClickOk = true, hideCancel = false, sessionIcon, iconSize, shouldShowConfirm, - // updateConfirmModal } = props; const okText = props.okText || window.i18n('ok'); @@ -55,19 +53,6 @@ const SessionConfirmInner = (props: SessionConfirmDialogProps) => { const messageSubText = messageSub ? 'session-confirm-main-message' : 'subtle'; - /** - * Calls close function after the ok button is clicked. If no close method specified, closes the modal - */ - const onClickOkWithClose = () => { - if (onClickOk) { - onClickOk(); - } - - if (onClickClose) { - onClickClose(); - } - }; - const onClickOkHandler = () => { if (onClickOk) { onClickOk(); @@ -80,6 +65,9 @@ const SessionConfirmInner = (props: SessionConfirmDialogProps) => { return null; } + /** + * Performs specified on close action then removes the modal. + */ const onClickCancelHandler = () => { if (onClickClose) { onClickClose(); diff --git a/ts/components/session/conversation/SessionCompositionBox.tsx b/ts/components/session/conversation/SessionCompositionBox.tsx index ce315adcd..c5341e22a 100644 --- a/ts/components/session/conversation/SessionCompositionBox.tsx +++ b/ts/components/session/conversation/SessionCompositionBox.tsx @@ -250,6 +250,9 @@ export class SessionCompositionBox extends React.Component { title: window.i18n('linkPreviewsTitle'), message: window.i18n('linkPreviewsConfirmMessage'), okTheme: SessionButtonColor.Danger, + onClickOk: () => { + window.setSettingValue('link-preview-setting', true); + } }); } }