fix: make sure all dialog "cancel" cancel the dialog

pull/3018/head
Audric Ackermann 2 years ago
parent 571d593c38
commit 5f0888d144

@ -106,6 +106,9 @@ export const ClickToTrustSender = (props: { messageId: string }) => {
}) })
); );
}, },
onClickClose: () => {
window.inboxStore?.dispatch(updateConfirmModal(null));
},
}) })
); );
}; };

@ -10,8 +10,8 @@ type Props = {
const StyledLabelContainer = styled(Flex)` const StyledLabelContainer = styled(Flex)`
div { div {
min-width: 50%;
// we want 2 items per row and that's the easiest to make it happen // we want 2 items per row and that's the easiest to make it happen
min-width: 50%;
} }
`; `;

@ -95,6 +95,9 @@ async function deleteEverythingAndNetworkData() {
await deleteDbLocally(); await deleteDbLocally();
window.restart(); window.restart();
}, },
onClickClose: () => {
window.inboxStore?.dispatch(updateConfirmModal(null));
},
}) })
); );
return; return;
@ -122,6 +125,9 @@ async function deleteEverythingAndNetworkData() {
await deleteDbLocally(); await deleteDbLocally();
window.restart(); window.restart();
}, },
onClickClose: () => {
window.inboxStore?.dispatch(updateConfirmModal(null));
},
}) })
); );
return; return;

@ -1,5 +1,6 @@
import { shell } from 'electron'; import { shell } from 'electron';
import React, { Dispatch, useEffect, useState } from 'react'; import React, { Dispatch, useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import styled from 'styled-components'; import styled from 'styled-components';
import { useLastMessage } from '../../hooks/useParamSelector'; import { useLastMessage } from '../../hooks/useParamSelector';
import { MessageInteraction } from '../../interactions'; import { MessageInteraction } from '../../interactions';
@ -69,6 +70,7 @@ export interface SessionConfirmDialogProps {
} }
export const SessionConfirm = (props: SessionConfirmDialogProps) => { export const SessionConfirm = (props: SessionConfirmDialogProps) => {
const dispatch = useDispatch();
const { const {
title = '', title = '',
message = '', message = '',
@ -113,7 +115,7 @@ export const SessionConfirm = (props: SessionConfirmDialogProps) => {
} }
if (closeAfterInput) { if (closeAfterInput) {
window.inboxStore?.dispatch(updateConfirmModal(null)); dispatch(updateConfirmModal(null));
} }
}; };
@ -137,13 +139,9 @@ export const SessionConfirm = (props: SessionConfirmDialogProps) => {
* Performs specified on close action then removes the modal. * Performs specified on close action then removes the modal.
*/ */
const onClickCancelHandler = () => { const onClickCancelHandler = () => {
if (onClickCancel) { onClickCancel?.();
onClickCancel();
}
if (onClickClose) { onClickClose?.();
onClickClose();
}
}; };
return ( return (

@ -58,7 +58,7 @@ export const InteractionItem = (props: InteractionItemProps) => {
switch (interactionType) { switch (interactionType) {
case ConversationInteractionType.Hide: case ConversationInteractionType.Hide:
// if it's hidden or pending hiding, we don't show it any text // if it's hidden or pending hiding, we don't show any text
break; break;
case ConversationInteractionType.Leave: case ConversationInteractionType.Leave:
errorText = isCommunity errorText = isCommunity

@ -32,6 +32,9 @@ async function toggleLinkPreviews(isToggleOn: boolean, forceUpdate: () => void)
await window.setSettingValue(SettingsKey.settingsLinkPreview, newValue); await window.setSettingValue(SettingsKey.settingsLinkPreview, newValue);
forceUpdate(); forceUpdate();
}, },
onClickClose: () => {
window.inboxStore?.dispatch(updateConfirmModal(null));
},
}) })
); );
} else { } else {

@ -377,6 +377,7 @@ export async function deleteMessagesById(messageIds: Array<string>, conversation
const messageCount = selectedMessages.length; const messageCount = selectedMessages.length;
const moreThanOne = selectedMessages.length > 1; const moreThanOne = selectedMessages.length > 1;
const closeDialog = () => window.inboxStore?.dispatch(updateConfirmModal(null));
window.inboxStore?.dispatch( window.inboxStore?.dispatch(
updateConfirmModal({ updateConfirmModal({
@ -401,6 +402,7 @@ export async function deleteMessagesById(messageIds: Array<string>, conversation
window.inboxStore?.dispatch(resetRightOverlayMode()); window.inboxStore?.dispatch(resetRightOverlayMode());
}, },
closeAfterInput: false, closeAfterInput: false,
onClickClose: closeDialog,
}) })
); );
} }

@ -116,7 +116,6 @@ async function sendToGroupMembers(
const allInvitesSent = _.every(inviteResults, inviteResult => inviteResult !== false); const allInvitesSent = _.every(inviteResults, inviteResult => inviteResult !== false);
if (allInvitesSent) { if (allInvitesSent) {
// if (true) {
if (isRetry) { if (isRetry) {
const invitesTitle = const invitesTitle =
inviteResults.length > 1 inviteResults.length > 1
@ -128,6 +127,9 @@ async function sendToGroupMembers(
title: invitesTitle, title: invitesTitle,
message: window.i18n('closedGroupInviteSuccessMessage'), message: window.i18n('closedGroupInviteSuccessMessage'),
hideCancel: true, hideCancel: true,
onClickClose: () => {
window.inboxStore?.dispatch(updateConfirmModal(null));
},
}) })
); );
} }
@ -167,6 +169,9 @@ async function sendToGroupMembers(
); );
} }
}, },
onClickClose: () => {
window.inboxStore?.dispatch(updateConfirmModal(null));
},
}) })
); );

Loading…
Cancel
Save