Skip to content

Commit 83b2ad8

Browse files
committed
fix: reactions malfunction
1 parent bce0df6 commit 83b2ad8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

web/src/lib/components/Chat.svelte

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
$: openContextMenu = null;
4343
$: editingMessage = null;
4444
$: replyingTo = null;
45-
$: reacting = false;
45+
$: reactingTo = null;
4646
$: addingEmoji = false;
4747
4848
onMount(() => {
@@ -52,7 +52,6 @@
5252
document.body.addEventListener('keydown', (event) => {
5353
if (event.key === 'Escape' && openContextMenu) {
5454
toggleContextMenu(openContextMenu, false);
55-
reacting = false;
5655
return;
5756
}
5857
if (event.key === 'Escape' && replyingTo) {
@@ -160,6 +159,8 @@
160159
sendMessage(token, contact.id, trimmed, replyingTo?.id).then((message) => {
161160
clearTimeout(typingTimeout);
162161
replyingTo = null;
162+
reactingTo = null;
163+
addingEmoji = false;
163164
isSelfTyping = false;
164165
messages = [...messages, message];
165166
typingMessage = '';
@@ -241,7 +242,7 @@
241242
} else {
242243
openContextMenu = on ? messageId : null;
243244
if (!on) {
244-
reacting = false;
245+
reactingTo = null;
245246
replyingTo = null;
246247
editingMessage = null;
247248
}
@@ -419,9 +420,9 @@
419420
</script>
420421

421422
<div class="chat" id="chat-{contact.id}">
422-
{#if reacting}
423+
{#if reactingTo}
423424
<EmojiMenu onClick={(emoji) => {
424-
reactEmoji(message, emoji.emoji);
425+
reactEmoji(reactingTo, emoji.emoji);
425426
}} center={true}/>
426427
{:else if addingEmoji}
427428
{@const position = calculateAddingEmojiPickerPosition()}
@@ -447,7 +448,7 @@
447448
toggleContextMenu(message.id, false);
448449
}}></div>
449450
<div class="message-context-menu-content {sent ? 'sent' : 'received'}" id={`message-context-menu-content-${message.id}`}>
450-
<button class="message-context-menu-item" on:click={() => { reacting = true; }}>
451+
<button class="message-context-menu-item" on:click={() => { reactingTo = message; }}>
451452
<span class="context-menu-tooltip">React</span>
452453
<i class="fa-regular fa-face-grin-tongue-wink"></i>
453454
</button>

0 commit comments

Comments
 (0)