Check the background queue when the response header is present
authorAlexander Ebert <ebert@woltlab.com>
Mon, 14 Nov 2022 15:12:31 +0000 (16:12 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 14 Nov 2022 15:12:31 +0000 (16:12 +0100)
ts/WoltLabSuite/Core/Ajax/DboAction.ts
ts/WoltLabSuite/Core/Ajax/Request.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/DboAction.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js

index 33cc99307870182976fc18d331eb2c04146715d4..d3367e4c5677a4baf3398ac1ba8863248f233e24 100644 (file)
@@ -148,7 +148,7 @@ export class DboAction {
         throw new InvalidJson(response);
       }
 
-      if (json.forceBackgroundQueuePerform) {
+      if (response.headers.get("woltlab-background-queue-check") === "yes" || json.forceBackgroundQueuePerform) {
         void import("../BackgroundQueue").then((BackgroundQueue) => BackgroundQueue.invoke());
       }
 
index 57c88b0605f5dcdf45f31552e0d031075937565a..d56edf8d9405153601639c8d2368b7e68b1a7416 100644 (file)
@@ -250,7 +250,10 @@ class AjaxRequest {
         }
 
         // force-invoke the background queue
-        if (data && data.forceBackgroundQueuePerform) {
+        if (
+          xhr.getResponseHeader("woltlab-background-queue-check") === "yes" ||
+          (data && data.forceBackgroundQueuePerform)
+        ) {
           void import("../BackgroundQueue").then((backgroundQueue) => backgroundQueue.invoke());
         }
       }
index 9ac171c0f8ff3e4dfc9b847be0a8ef27b86f2926..87787d915eb55b6b260d4b92e127dbc21759131d 100644 (file)
@@ -104,7 +104,7 @@ define(["require", "exports", "tslib", "./Error", "./Status", "../Core"], functi
                 catch (e) {
                     throw new Error_1.InvalidJson(response);
                 }
-                if (json.forceBackgroundQueuePerform) {
+                if (response.headers.get("woltlab-background-queue-check") === "yes" || json.forceBackgroundQueuePerform) {
                     void new Promise((resolve_1, reject_1) => { require(["../BackgroundQueue"], resolve_1, reject_1); }).then(tslib_1.__importStar).then((BackgroundQueue) => BackgroundQueue.invoke());
                 }
                 return json.returnValues;
index 683f8e4df9374349b49cb08a12ad9cc71a71bbe2..e5357351d33bb0322ce94568e2c6811e1c13956b 100644 (file)
@@ -214,7 +214,8 @@ define(["require", "exports", "tslib", "./Status", "../Core", "../Dom/Change/Lis
                         data.returnValues.template = data.returnValues.template.trim();
                     }
                     // force-invoke the background queue
-                    if (data && data.forceBackgroundQueuePerform) {
+                    if (xhr.getResponseHeader("woltlab-background-queue-check") === "yes" ||
+                        (data && data.forceBackgroundQueuePerform)) {
                         void new Promise((resolve_1, reject_1) => { require(["../BackgroundQueue"], resolve_1, reject_1); }).then(tslib_1.__importStar).then((backgroundQueue) => backgroundQueue.invoke());
                     }
                 }