From 74614b89417018b6c4827f840671041862113431 Mon Sep 17 00:00:00 2001 From: ubermanu <e.vodor@gmail.com> Date: Mon, 15 Mar 2021 19:26:07 +0100 Subject: [PATCH] bugfix: allow replies in private chats --- src/plugins/sib-reply-to-message.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/sib-reply-to-message.js b/src/plugins/sib-reply-to-message.js index 2b7e8d0..1d878ce 100644 --- a/src/plugins/sib-reply-to-message.js +++ b/src/plugins/sib-reply-to-message.js @@ -14,9 +14,8 @@ converse.plugins.add('sib-reply-to-message', { api.listen.on('getMessageActionButtons', (el, buttons) => { - // Do not add if the message is not from a MUC // Do not add if the message is from the current user - if (el.model.get('type') !== 'groupchat' || el.model.get('sender') === 'me') { + if (el.model.get('sender') === 'me') { return buttons; } @@ -32,8 +31,12 @@ converse.plugins.add('sib-reply-to-message', { chat_textarea.value += `${message.replace(/^/gm, '>')}\n`; } - // Add mention to the initial user and focus textarea - chat_textarea.value += `@${el.model.get('nick')} `; + // Add mention to the initial author for MUCs + const nickname = el.model.get('nick'); + if (el.model.get('type') === 'groupchat' && nickname.length) { + chat_textarea.value += `@${nickname} `; + } + chat_textarea.focus(); }, 'button_class': 'chat-msg__action-reply', -- GitLab