From cf4cb43228121cf0cd704ac0f259c19125a4f259 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 24 Oct 2021 14:57:39 +0200 Subject: [PATCH] Workaround for multiple quote handlers on one page --- ts/WoltLabSuite/Core/Ui/Message/Quote.ts | 10 +++++++++- .../files/js/WoltLabSuite/Core/Ui/Message/Quote.js | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ts/WoltLabSuite/Core/Ui/Message/Quote.ts b/ts/WoltLabSuite/Core/Ui/Message/Quote.ts index 63768264c0..e351336f7b 100644 --- a/ts/WoltLabSuite/Core/Ui/Message/Quote.ts +++ b/ts/WoltLabSuite/Core/Ui/Message/Quote.ts @@ -310,7 +310,15 @@ export class UiMessageQuote implements AjaxCallbackObject { return; } - const container = this.containers.get(this.activeMessageId)!; + const container = this.containers.get(this.activeMessageId); + if (container === undefined) { + // Since 5.4 we listen for global mouse events, because those are much + // more reliable on mobile devices. However, this can cause conflicts + // if two or more types of message types with quote support coexist on + // the same page. + return; + } + const objectId = ~~container.dataset.objectId!; const content = this.messageBodySelector ? (container.querySelector(this.messageBodySelector) as HTMLElement) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js index 97fb96a8e4..fb175a0416 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js @@ -215,6 +215,13 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/ return; } const container = this.containers.get(this.activeMessageId); + if (container === undefined) { + // Since 5.4 we listen for global mouse events, because those are much + // more reliable on mobile devices. However, this can cause conflicts + // if two or more types of message types with quote support coexist on + // the same page. + return; + } const objectId = ~~container.dataset.objectId; const content = this.messageBodySelector ? container.querySelector(this.messageBodySelector) -- 2.20.1