Add `callbackSuccess` support for `AcpUserContentRemoveHandler`
authorjoshuaruesweg <ruesweg@woltlab.com>
Mon, 9 Aug 2021 09:59:19 +0000 (11:59 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Mon, 9 Aug 2021 10:08:21 +0000 (12:08 +0200)
ts/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.js

index fa87386b89eecf4dbd5b464fe2a6dc40d78ec606..3e84f9e93822d3afc9c8e0692f154e1c2f6205a5 100644 (file)
@@ -15,6 +15,16 @@ import UiDialog from "../../../../../Ui/Dialog";
 import { AjaxCallbackSetup } from "../../../../../Ajax/Data";
 import { DialogCallbackSetup } from "../../../../../Ui/Dialog/Data";
 
+type CallbackSuccess = (data: AjaxResponseSuccess) => void;
+
+interface AjaxResponseSuccess {
+  loopCount: number;
+  parameters: ArbitraryObject;
+  proceedURL: string;
+  progress: number;
+  template?: string;
+}
+
 interface AjaxResponse {
   returnValues: {
     template: string;
@@ -24,13 +34,15 @@ interface AjaxResponse {
 class AcpUserContentRemoveHandler {
   private readonly dialogId: string;
   private readonly userId: number;
+  private readonly callbackSuccess: CallbackSuccess | null | undefined;
 
   /**
    * Initializes the content remove handler.
    */
-  constructor(element: HTMLElement, userId: number) {
+  constructor(element: HTMLElement, userId: number, callbackSuccess?: CallbackSuccess | null) {
     this.userId = userId;
     this.dialogId = `userRemoveContentHandler-${this.userId}`;
+    this.callbackSuccess = callbackSuccess;
 
     element.addEventListener("click", (ev) => this.click(ev));
   }
@@ -59,6 +71,7 @@ class AcpUserContentRemoveHandler {
         userID: this.userId,
         contentProvider: objectTypes,
       },
+      callbackSuccess: this.callbackSuccess,
     });
   }
 
index 20b97f5e16244a311b6b8cc48be37d32fc84a37a..ae4dd3e0fb13fa54c590618dbc4fbeb31c44dd24 100644 (file)
@@ -17,9 +17,10 @@ define(["require", "exports", "tslib", "../../../Worker", "../../../../../Ajax",
         /**
          * Initializes the content remove handler.
          */
-        constructor(element, userId) {
+        constructor(element, userId, callbackSuccess) {
             this.userId = userId;
             this.dialogId = `userRemoveContentHandler-${this.userId}`;
+            this.callbackSuccess = callbackSuccess;
             element.addEventListener("click", (ev) => this.click(ev));
         }
         /**
@@ -43,6 +44,7 @@ define(["require", "exports", "tslib", "../../../Worker", "../../../../../Ajax",
                     userID: this.userId,
                     contentProvider: objectTypes,
                 },
+                callbackSuccess: this.callbackSuccess,
             });
         }
         /**