Workaround for multiple quote handlers on one page
authorAlexander Ebert <ebert@woltlab.com>
Sun, 24 Oct 2021 12:57:39 +0000 (14:57 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 24 Oct 2021 12:57:39 +0000 (14:57 +0200)
ts/WoltLabSuite/Core/Ui/Message/Quote.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js

index 63768264c095597b0e8b46a04b04f60982a8a00f..e351336f7bb727a3152ba8022c7b15258848c971 100644 (file)
@@ -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)
index 97fb96a8e4bbd64531f97368f751cc6221dc1db1..fb175a0416a30a772013b6f11dc38f803e2cbf50 100644 (file)
@@ -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)