From b3314056580a291ec2476e308c59046a5cffd80d Mon Sep 17 00:00:00 2001 From: SilverYoCha Date: Mon, 4 Apr 2022 11:53:50 +0200 Subject: [PATCH] Bugfix: selected emoji inserted into all open chat boxes when in overlay view mode. --- CHANGES.md | 1 + package-lock.json | 14 ++++++++++++-- src/plugins/chatview/message-form.js | 12 ++++++------ src/shared/chat/emoji-picker.js | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8900d2b74..0d3f34d85 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ ## 9.1.1 (Unreleased) - GIFs don't render inside unfurls and cause a TypeError +- #2868: Selected emoji is inserted into all open chat boxes ## 9.1.0 (2022-04-02) diff --git a/package-lock.json b/package-lock.json index ea1d25806..32bb70771 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13179,6 +13179,12 @@ "node": "*" } }, + "node_modules/prettierx/node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, "node_modules/prettierx/node_modules/postcss-selector-parser": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz", @@ -18300,7 +18306,6 @@ }, "@converse/skeletor": { "version": "git+ssh://git@github.com/conversejs/skeletor.git#c7e76b023337a8ac201c74507f7a1209de1c6d18", - "integrity": "sha512-2g+6XxFUorhlHncfkBWB8+26+8Izl2kJYf+1uk/Umb53/ltvCgtCJcQuAECmKXC/y99yCjNWot+qhA+tQK9sWQ==", "from": "@converse/skeletor@conversejs/skeletor#c7e76b023337a8ac201c74507f7a1209de1c6d18", "requires": { "lit-html": "^2.0.0-rc.2", @@ -25065,7 +25070,6 @@ }, "localforage-getitems": { "version": "git+ssh://git@github.com/conversejs/localForage-getItems.git#de039970de16a9d3b54cdaa816aed5adaefb80c9", - "integrity": "sha512-fPxYV2vJFx2onqHfL+En0bTesjawTmn1v/peYf/0gaYL7uhx5nP9czVHNUYAXoKL9kKplVH8lZo4LRrE2MK23w==", "from": "localforage-getitems@conversejs/localForage-getItems#de039970de16a9d3b54cdaa816aed5adaefb80c9", "requires": { "localforage": ">=1.4.0" @@ -27201,6 +27205,12 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, "postcss-selector-parser": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz", diff --git a/src/plugins/chatview/message-form.js b/src/plugins/chatview/message-form.js index 4576f3955..c6526856b 100644 --- a/src/plugins/chatview/message-form.js +++ b/src/plugins/chatview/message-form.js @@ -17,12 +17,12 @@ export default class MessageForm extends ElementView { this.listenTo(this.model.messages, 'change:correcting', this.onMessageCorrecting); this.listenTo(this.model, 'change:composing_spoiler', () => this.render()); - this.handleEmojiSelection = ({ detail }) => this.insertIntoTextArea( - detail.value, - detail.autocompleting, - false, - detail.ac_position - ); + this.handleEmojiSelection = ({ detail }) => { + debugger; + if (this.model.get('jid') === detail.jid) { + this.insertIntoTextArea(detail.value, detail.autocompleting, false, detail.ac_position); + } + } document.addEventListener("emojiSelected", this.handleEmojiSelection); this.render(); } diff --git a/src/shared/chat/emoji-picker.js b/src/shared/chat/emoji-picker.js index c672d809c..69d0b4e88 100644 --- a/src/shared/chat/emoji-picker.js +++ b/src/shared/chat/emoji-picker.js @@ -155,9 +155,10 @@ export default class EmojiPicker extends CustomElement { const ac_position = this.model.get('ac_position'); this.model.set({'autocompleting': null, 'query': '', 'ac_position': null}); this.disableArrowNavigation(); + const jid = this.chatview.model.get('jid'); const options = { 'bubbles': true, - 'detail': { value, autocompleting, ac_position } + 'detail': { value, autocompleting, ac_position, jid } }; this.dispatchEvent(new CustomEvent("emojiSelected", options)); }