From 3c5f0bf018ccccac5be35e29ec5cfb7cf8a84522 Mon Sep 17 00:00:00 2001
From: William Grant <willmgrant@gmail.com>
Date: Wed, 24 Jan 2024 13:45:01 +1100
Subject: [PATCH] fix: only close panel when we confirm delete

rtl text support in panelbutton and panelradiobutton
---
 ts/components/buttons/PanelButton.tsx                       | 6 ++----
 ts/components/buttons/PanelRadioButton.tsx                  | 2 +-
 .../right-panel/overlay/message-info/OverlayMessageInfo.tsx | 2 --
 ts/interactions/conversations/unsendingInteractions.ts      | 5 ++++-
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ts/components/buttons/PanelButton.tsx b/ts/components/buttons/PanelButton.tsx
index 123231d00..868bf9bbd 100644
--- a/ts/components/buttons/PanelButton.tsx
+++ b/ts/components/buttons/PanelButton.tsx
@@ -17,8 +17,7 @@ export const StyledText = styled.span<{ color?: string }>`
   overflow: hidden;
   text-overflow: ellipsis;
   width: 100%;
-  /* TODO needs RTL support */
-  text-align: left;
+  text-align: start;
   ${props => props.color && `color: ${props.color};`}
 `;
 
@@ -113,8 +112,7 @@ const StyledSubtitle = styled.p<{ color?: string }>`
   line-height: 1.1;
   margin-top: 0;
   margin-bottom: 0;
-  /* TODO needs RTL support */
-  text-align: left;
+  text-align: start;
   ${props => props.color && `color: ${props.color};`}
 `;
 
diff --git a/ts/components/buttons/PanelRadioButton.tsx b/ts/components/buttons/PanelRadioButton.tsx
index 6f0cb2c41..4db2594b9 100644
--- a/ts/components/buttons/PanelRadioButton.tsx
+++ b/ts/components/buttons/PanelRadioButton.tsx
@@ -6,7 +6,7 @@ import { PanelButton, PanelButtonProps, PanelButtonText, StyledContent } from '.
 const StyledPanelButton = styled(PanelButton)`
   padding-top: var(--margins-lg);
   padding-bottom: var(--margins-lg);
-  text-align: left;
+  text-align: start;
 `;
 
 const StyledCheckContainer = styled.div`
diff --git a/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx b/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx
index 2acef34ac..c3f081f1b 100644
--- a/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx
+++ b/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx
@@ -233,8 +233,6 @@ export const OverlayMessageInfo = () => {
                   dataTestId="delete-from-details"
                   onClick={() => {
                     void deleteMessagesById([messageId], convoId);
-                    dispatch(closeRightPanel());
-                    dispatch(resetRightOverlayMode());
                   }}
                 />
               )}
diff --git a/ts/interactions/conversations/unsendingInteractions.ts b/ts/interactions/conversations/unsendingInteractions.ts
index 84c062883..50f055248 100644
--- a/ts/interactions/conversations/unsendingInteractions.ts
+++ b/ts/interactions/conversations/unsendingInteractions.ts
@@ -12,8 +12,9 @@ import { UnsendMessage } from '../../session/messages/outgoing/controlMessage/Un
 import { ed25519Str } from '../../session/onions/onionPath';
 import { PubKey } from '../../session/types';
 import { ToastUtils, UserUtils } from '../../session/utils';
-import { resetSelectedMessageIds } from '../../state/ducks/conversations';
+import { closeRightPanel, resetSelectedMessageIds } from '../../state/ducks/conversations';
 import { updateConfirmModal } from '../../state/ducks/modalDialog';
+import { resetRightOverlayMode } from '../../state/ducks/section';
 
 /**
  * Deletes messages for everyone in a 1-1 or everyone in a closed group conversation.
@@ -393,6 +394,8 @@ export async function deleteMessagesById(messageIds: Array<string>, conversation
           deleteForEveryone: args === 'deleteForEveryone', // chosenOption from radioOptions
         });
         window.inboxStore?.dispatch(updateConfirmModal(null));
+        window.inboxStore?.dispatch(closeRightPanel());
+        window.inboxStore?.dispatch(resetRightOverlayMode());
       },
       closeAfterInput: false,
     })