From e76907e0c1d46f664822b84494026c0065c6e39a Mon Sep 17 00:00:00 2001 From: joshuaruesweg Date: Mon, 9 Aug 2021 11:59:19 +0200 Subject: [PATCH] Add `callbackSuccess` support for `AcpUserContentRemoveHandler` --- .../Core/Acp/Ui/User/Content/Remove/Handler.ts | 15 ++++++++++++++- .../Core/Acp/Ui/User/Content/Remove/Handler.js | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.ts index fa87386b89..3e84f9e938 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.ts @@ -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, }); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.js index 20b97f5e16..ae4dd3e0fb 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.js @@ -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, }); } /** -- 2.20.1