From b3466260910abea6c8b5b3e6cba18393edfc9798 Mon Sep 17 00:00:00 2001
From: hackerbirds <120066692+hackerbirds@users.noreply.github.com>
Date: Sun, 27 Oct 2024 23:01:45 -0400
Subject: [PATCH] Prevent sticker picker from being opened in incompatible
situations The sticker picker could be opened when the user is about to send
an attachment, or a reply, or text, neither of which can be combined with
stickers
---
ts/components/CompositionArea.tsx | 61 ++++++++++++++++---------------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/ts/components/CompositionArea.tsx b/ts/components/CompositionArea.tsx
index 2755d587c2..f8ec5955e5 100644
--- a/ts/components/CompositionArea.tsx
+++ b/ts/components/CompositionArea.tsx
@@ -655,35 +655,36 @@ export const CompositionArea = memo(function CompositionArea({
>
) : null;
+ const shouldShowStickers =
+ !quotedMessageProps && isComposerEmpty && withStickers;
const stickerButtonPlacement = large ? 'top-start' : 'top-end';
- const stickerButtonFragment =
- !draftEditMessage && withStickers ? (
-
-
- pushPanelForConversation({
- type: PanelType.StickerManager,
- })
- }
- onPickSticker={(packId, stickerId) =>
- sendStickerMessage(conversationId, { packId, stickerId })
- }
- showIntroduction={showIntroduction}
- clearShowIntroduction={clearShowIntroduction}
- showPickerHint={showPickerHint}
- clearShowPickerHint={clearShowPickerHint}
- position={stickerButtonPlacement}
- />
-
- ) : null;
+ const stickerButtonFragment = shouldShowStickers ? (
+
+
+ pushPanelForConversation({
+ type: PanelType.StickerManager,
+ })
+ }
+ onPickSticker={(packId, stickerId) =>
+ sendStickerMessage(conversationId, { packId, stickerId })
+ }
+ showIntroduction={showIntroduction}
+ clearShowIntroduction={clearShowIntroduction}
+ showPickerHint={showPickerHint}
+ clearShowPickerHint={clearShowPickerHint}
+ position={stickerButtonPlacement}
+ />
+
+ ) : null;
// Listen for cmd/ctrl-shift-x to toggle large composition mode
useEffect(() => {
@@ -1053,7 +1054,7 @@ export const CompositionArea = memo(function CompositionArea({
{!large ? (
<>
- {stickerButtonFragment}
+ {!dirty ? stickerButtonFragment : null}
{!dirty ? micButtonFragment : null}
{editMessageFragment}
{attButton}
@@ -1068,7 +1069,7 @@ export const CompositionArea = memo(function CompositionArea({
)}
>
{leftHandSideButtonsFragment}
- {stickerButtonFragment}
+ {!dirty ? stickerButtonFragment : null}
{attButton}
{!dirty ? micButtonFragment : null}
{editMessageFragment}