Apply suggestions from code review
authorjoshuaruesweg <ruesweg@woltlab.com>
Mon, 9 Aug 2021 12:47:35 +0000 (14:47 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Fri, 13 Aug 2021 10:03:35 +0000 (12:03 +0200)
25 files changed:
ts/WoltLabSuite/Core/Acp/Ui/User/Action/Abstract.ts [new file with mode: 0644]
ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts [deleted file]
ts/WoltLabSuite/Core/Acp/Ui/User/Action/BanAction.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/DeleteAction.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban/Dialog.ts [new file with mode: 0644]
ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Delete.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.ts [deleted file]
ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/SendNewPassword.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Editor.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Abstract.js [new file with mode: 0644]
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/BanAction.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/DeleteAction.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban/Dialog.js [new file with mode: 0644]
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Delete.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.js [deleted file]
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/SendNewPassword.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.js

diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Abstract.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Abstract.ts
new file mode 100644 (file)
index 0000000..835c437
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * An abstract action, to handle user actions.
+ *
+ * @author  Joshua Ruesweg
+ * @copyright  2001-2021 WoltLab GmbH
+ * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Acp/Ui/User/Action
+ * @since       5.5
+ */
+
+export abstract class AbstractUserAction {
+  protected readonly button: HTMLElement;
+  protected readonly userDataElement: HTMLElement;
+  protected readonly userId: number;
+
+  public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
+    this.button = button;
+    this.userId = userId;
+    this.userDataElement = userDataElement;
+  }
+}
+
+export default AbstractUserAction;
diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts
deleted file mode 100644 (file)
index 75a3ace..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @author  Joshua Ruesweg
- * @copyright  2001-2021 WoltLab GmbH
- * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module  WoltLabSuite/Core/Acp/Ui/User/Action
- * @since       5.5
- */
-
-export abstract class AbstractUserAction {
-  protected readonly button: HTMLElement;
-  protected readonly userDataElement: HTMLElement;
-  protected readonly userId: number;
-
-  public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
-    this.button = button;
-    this.userId = userId;
-    this.userDataElement = userDataElement;
-
-    this.init();
-  }
-
-  protected abstract init(): void;
-}
-
-export default AbstractUserAction;
index 6085667bac9e7aa1fedcb407ba8939e09705732f..4c3e69baef225dba81c3db43a15cec3968477890 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a user ban button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
@@ -7,7 +9,7 @@
  */
 
 import * as Core from "../../../../Core";
-import AbstractUserAction from "./AbstractUserAction";
+import AbstractUserAction from "./Abstract";
 import BanHandler from "./Handler/Ban";
 import * as UiNotification from "../../../../Ui/Notification";
 import * as EventHandler from "../../../../Event/Handler";
@@ -15,7 +17,9 @@ import * as EventHandler from "../../../../Event/Handler";
 export class BanAction extends AbstractUserAction {
   private banHandler: BanHandler;
 
-  protected init(): void {
+  public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
+    super(button, userId, userDataElement);
+
     this.banHandler = new BanHandler([this.userId]);
 
     this.button.addEventListener("click", (event) => {
index 37efb572fc851fac28f86fb67c5cb31f42fc1f77..21ee45287a66fdb50091fca221385fbde3c7a192 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a user delete button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
@@ -6,24 +8,26 @@
  * @since       5.5
  */
 
-import AbstractUserAction from "./AbstractUserAction";
+import AbstractUserAction from "./Abstract";
 import Delete from "./Handler/Delete";
 
 export class DeleteAction extends AbstractUserAction {
-  protected init(): void {
+  public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
+    super(button, userId, userDataElement);
+
+    if (typeof this.button.dataset.confirmMessage !== "string") {
+      throw new Error("The button does not provide a confirmMessage.");
+    }
+
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
 
-      if (!(typeof this.button.dataset.confirmMessage === "string")) {
-        throw new Error("The button does not provides a confirmMessage.");
-      }
-
       const deleteHandler = new Delete(
         [this.userId],
         () => {
           this.userDataElement.remove();
         },
-        this.button.dataset.confirmMessage,
+        this.button.dataset.confirmMessage!,
       );
       deleteHandler.delete();
     });
index fe842dd31d9cb6f0a462f1527f2b7d2d1a00a472..d5baf0ff70260b1efad04ace30847431144487fd 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a user disable/enable button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
@@ -10,11 +12,13 @@ import * as Ajax from "../../../../Ajax";
 import * as Core from "../../../../Core";
 import { AjaxCallbackObject, AjaxCallbackSetup, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
 import * as UiNotification from "../../../../Ui/Notification";
-import AbstractUserAction from "./AbstractUserAction";
+import AbstractUserAction from "./Abstract";
 import * as EventHandler from "../../../../Event/Handler";
 
 export class DisableAction extends AbstractUserAction implements AjaxCallbackObject {
-  protected init(): void {
+  public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
+    super(button, userId, userDataElement);
+
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
       const isEnabled = Core.stringToBool(this.userDataElement.dataset.enabled!);
index f3968348e348fe1149eee239f70190c3d74dca0b..8628704c6217a184e185be7a12af3b15f869042f 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a user ban.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
@@ -7,21 +9,22 @@
  */
 
 import * as Ajax from "../../../../../Ajax";
-import BanDialog from "./Dialog/Ban";
+import BanDialog from "./Ban/Dialog";
+
+type Callback = () => void;
 
 export class BanHandler {
   private userIDs: number[];
-  private banCallback: () => void;
 
   public constructor(userIDs: number[]) {
     this.userIDs = userIDs;
   }
 
-  public ban(callback: () => void): void {
+  public ban(callback: Callback): void {
     BanDialog.open(this.userIDs, callback);
   }
 
-  public unban(callback: () => void): void {
+  public unban(callback: Callback): void {
     Ajax.api({
       _ajaxSetup: () => {
         return {
@@ -32,7 +35,7 @@ export class BanHandler {
           },
         };
       },
-      _ajaxSuccess: callback,
+      _ajaxSuccess: () => callback(),
     });
   }
 }
diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban/Dialog.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban/Dialog.ts
new file mode 100644 (file)
index 0000000..c5c7ffe
--- /dev/null
@@ -0,0 +1,150 @@
+/**
+ * Creates and handles the dialog to ban a user.
+ *
+ * @author  Joshua Ruesweg
+ * @copyright  2001-2021 WoltLab GmbH
+ * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban
+ * @since       5.5
+ */
+
+import UiDialog from "../../../../../../Ui/Dialog";
+import { DialogCallbackSetup } from "../../../../../../Ui/Dialog/Data";
+import * as Language from "../../../../../../Language";
+import * as Ajax from "../../../../../../Ajax";
+import DatePicker from "../../../../../../Date/Picker";
+
+type Callback = () => void;
+
+export class BanDialog {
+  private static instance: BanDialog;
+
+  private banCallback: Callback;
+  private userIDs: number[];
+  private submitElement: HTMLElement;
+  private neverExpiresCheckbox: HTMLInputElement;
+  private reasonInput: HTMLInputElement;
+  private userBanExpiresSettingsElement: HTMLElement;
+  private dialogContent: HTMLElement;
+
+  public static open(userIDs: number[], callback: Callback): void {
+    if (!BanDialog.instance) {
+      BanDialog.instance = new BanDialog();
+    }
+
+    BanDialog.instance.setCallback(callback);
+    BanDialog.instance.setUserIDs(userIDs);
+    BanDialog.instance.openDialog();
+  }
+
+  private openDialog(): void {
+    UiDialog.open(this);
+  }
+
+  private setCallback(callback: Callback): void {
+    this.banCallback = callback;
+  }
+
+  private setUserIDs(userIDs: number[]): void {
+    this.userIDs = userIDs;
+  }
+
+  private banSubmit(reason: string, expires: string): void {
+    Ajax.apiOnce({
+      data: {
+        actionName: "ban",
+        className: "wcf\\data\\user\\UserAction",
+        objectIDs: this.userIDs,
+        parameters: {
+          banReason: reason,
+          banExpires: expires,
+        },
+      },
+      success: this.banCallback,
+    });
+  }
+
+  private cleanupDialog(): void {
+    this.reasonInput.value = "";
+    this.neverExpiresCheckbox.checked = true;
+    DatePicker.clear("userBanExpires");
+    this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
+  }
+
+  _dialogSetup(): ReturnType<DialogCallbackSetup> {
+    return {
+      id: "userBanHandler",
+      options: {
+        onSetup: (content: HTMLElement): void => {
+          this.dialogContent = content;
+          this.submitElement = content.querySelector(".formSubmitButton")! as HTMLElement;
+          this.reasonInput = content.querySelector("#userBanReason")! as HTMLInputElement;
+          this.neverExpiresCheckbox = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
+          this.userBanExpiresSettingsElement = content.querySelector("#userBanExpiresSettings")! as HTMLElement;
+
+          this.submitElement.addEventListener("click", (event) => {
+            event.preventDefault();
+
+            const expires = this.neverExpiresCheckbox.checked ? "" : DatePicker.getValue("userBanExpires");
+            this.banSubmit(this.reasonInput.value, expires);
+
+            UiDialog.close(this);
+
+            this.cleanupDialog();
+          });
+
+          this.neverExpiresCheckbox.addEventListener("change", (event) => {
+            const checkbox = event.currentTarget as HTMLInputElement;
+            if (checkbox.checked) {
+              this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
+            } else {
+              this.userBanExpiresSettingsElement.style.removeProperty("display");
+            }
+          });
+        },
+        title: Language.get("wcf.acp.user.ban.sure"),
+      },
+      source: `
+ <div class="section">
+   <dl>
+     <dt><label for="userBanReason">${Language.get("wcf.acp.user.banReason")}</label></dt>
+     <dd>
+       <textarea id="userBanReason" cols="40" rows="3" class=""></textarea>
+       <small>${Language.get("wcf.acp.user.banReason.description")}</small>
+     </dd>
+   </dl>
+   <dl>
+     <dt></dt>
+     <dd>
+       <label for="userBanNeverExpires">
+         <input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
+         ${Language.get("wcf.acp.user.ban.neverExpires")}
+       </label>
+     </dd>
+   </dl>
+   <dl id="userBanExpiresSettings" style="display: none;">
+     <dt>
+       <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
+     </dt>
+     <dd>
+       <div class="inputAddon">
+         <input  type="date"
+                 name="userBanExpires"
+                 id="userBanExpires"
+                 class="medium"
+                 min="${new Date(window.TIME_NOW * 1000).toISOString()}"
+                 data-ignore-timezone="true"
+         />
+       </div>
+       <small>${Language.get("wcf.acp.user.ban.expires.description")}</small>
+     </dd>
+   </dl>
+ </div>
+ <div class="formSubmit dialogFormSubmit">
+   <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get("wcf.global.button.submit")}</button>
+ </div>`,
+    };
+  }
+}
+
+export default BanDialog;
index 551912f01e9158f6b83bb2db79aba956fccdb2cb..9ee1a7f6aba9f57338a4d68a0c59f7fb7277fd26 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Deletes a given user.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.ts
deleted file mode 100644 (file)
index 51caf7a..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * @author  Joshua Ruesweg
- * @copyright  2001-2021 WoltLab GmbH
- * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module  WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog
- * @since       5.5
- */
-
-import UiDialog from "../../../../../../Ui/Dialog";
-import { DialogCallbackSetup } from "../../../../../../Ui/Dialog/Data";
-import * as Language from "../../../../../../Language";
-import * as Ajax from "../../../../../../Ajax";
-import DatePicker from "../../../../../../Date/Picker";
-
-export class BanDialog {
-  private static instance: BanDialog;
-
-  private banCallback: () => void;
-  private userIDs: number[];
-  private submitElement: HTMLElement;
-  private neverExpiresCheckbox: HTMLInputElement;
-  private reasonInput: HTMLInputElement;
-  private userBanExpiresSettingsElement: HTMLElement;
-  private dialogContent: HTMLElement;
-  public static open(userIDs: number[], callback: () => void): void {
-    if (!BanDialog.instance) {
-      BanDialog.instance = new BanDialog();
-    }
-
-    BanDialog.instance.setCallback(callback);
-    BanDialog.instance.setUserIDs(userIDs);
-    BanDialog.instance.openDialog();
-  }
-
-  private openDialog(): void {
-    UiDialog.open(this);
-  }
-
-  private setCallback(callback: () => void): void {
-    this.banCallback = callback;
-  }
-
-  private setUserIDs(userIDs: number[]) {
-    this.userIDs = userIDs;
-  }
-
-  private banSubmit(reason: string, expires: string): void {
-    Ajax.apiOnce({
-      data: {
-        actionName: "ban",
-        className: "wcf\\data\\user\\UserAction",
-        objectIDs: this.userIDs,
-        parameters: {
-          banReason: reason,
-          banExpires: expires,
-        },
-      },
-      success: this.banCallback,
-    });
-  }
-
-  private cleanupDialog(): void {
-    this.reasonInput.value = "";
-    this.neverExpiresCheckbox.checked = true;
-    DatePicker.clear("userBanExpires");
-    this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
-  }
-
-  _dialogSetup(): ReturnType<DialogCallbackSetup> {
-    return {
-      id: "userBanHandler",
-      options: {
-        onSetup: (content: HTMLElement): void => {
-          this.dialogContent = content;
-          this.submitElement = content.querySelector(".formSubmitButton")! as HTMLElement;
-          this.reasonInput = content.querySelector("#userBanReason")! as HTMLInputElement;
-          this.neverExpiresCheckbox = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
-          this.userBanExpiresSettingsElement = content.querySelector("#userBanExpiresSettings")! as HTMLElement;
-
-          this.submitElement.addEventListener("click", (event) => {
-            event.preventDefault();
-
-            const expires = this.neverExpiresCheckbox.checked ? "" : DatePicker.getValue("userBanExpires");
-            this.banSubmit(this.reasonInput.value, expires);
-
-            UiDialog.close(this);
-
-            this.cleanupDialog();
-          });
-
-          this.neverExpiresCheckbox.addEventListener("change", (event) => {
-            const checkbox = event.currentTarget as HTMLInputElement;
-            if (checkbox.checked) {
-              this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
-            } else {
-              this.userBanExpiresSettingsElement.style.removeProperty("display");
-            }
-          });
-        },
-        title: Language.get("wcf.acp.user.ban.sure"),
-      },
-      source: `
-<div class="section">
-  <dl>
-    <dt><label for="userBanReason">${Language.get("wcf.acp.user.banReason")}</label></dt>
-    <dd>
-      <textarea id="userBanReason" cols="40" rows="3" class=""></textarea>
-      <small>${Language.get("wcf.acp.user.banReason.description")}</small>
-    </dd>
-  </dl>
-  <dl>
-    <dt></dt>
-    <dd>
-      <label for="userBanNeverExpires">
-        <input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
-        ${Language.get("wcf.acp.user.ban.neverExpires")}
-      </label>
-    </dd>
-  </dl>
-  <dl id="userBanExpiresSettings" style="display: none;">
-    <dt>
-      <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
-    </dt>
-    <dd>
-      <div class="inputAddon">
-        <input  type="date"
-                name="userBanExpires"
-                id="userBanExpires"
-                class="medium"
-                min="${new Date(window.TIME_NOW * 1000).toISOString()}"
-                data-ignore-timezone="true"
-        />
-      </div>
-      <small>${Language.get("wcf.acp.user.ban.expires.description")}</small>
-    </dd>
-  </dl>
-</div>
-<div class="formSubmit dialogFormSubmit">
-  <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get("wcf.global.button.submit")}</button>
-</div>`,
-    };
-  }
-}
-
-export default BanDialog;
index 0578c44e9d8fe6cddf80356c33e04a5f6dab703d..fa954d38814451d1d6693126e796fba87bcecf45 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a send new password action.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
index 9e2024a2795e526f372bc8d5b86cba9e98609294..819f80381aceca1368262f90fbbac014ada20bd0 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a send new password button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
@@ -6,11 +8,13 @@
  * @since       5.5
  */
 
-import AbstractUserAction from "./AbstractUserAction";
+import AbstractUserAction from "./Abstract";
 import SendNewPassword from "./Handler/SendNewPassword";
 
 export class SendNewPasswordAction extends AbstractUserAction {
-  protected init(): void {
+  public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
+    super(button, userId, userDataElement);
+
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
 
index 584eb9a86fa1b0cf88214cbcecfa3afe4f32872f..3da9abb7dd372f14551d55a664f741558e5a554c 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a toggle confirm email button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
@@ -6,20 +8,22 @@
  * @since       5.5
  */
 
-import AbstractUserAction from "./AbstractUserAction";
+import AbstractUserAction from "./Abstract";
 import * as Ajax from "../../../../Ajax";
 import * as Core from "../../../../Core";
 import { AjaxCallbackSetup, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
 import * as UiNotification from "../../../../Ui/Notification";
 
 export class ToggleConfirmEmailAction extends AbstractUserAction {
-  protected init(): void {
+  public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
+    super(button, userId, userDataElement);
+
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
       const isEmailConfirmed = Core.stringToBool(this.userDataElement.dataset.emailConfirmed!);
 
       Ajax.api(this, {
-        actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
+        actionName: isEmailConfirmed ? "unconfirmEmail" : "confirmEmail",
       });
     });
   }
index 3e84f9e93822d3afc9c8e0692f154e1c2f6205a5..bc3cfba36d755363615d873244cc2f9eda411045 100644 (file)
@@ -34,12 +34,12 @@ interface AjaxResponse {
 class AcpUserContentRemoveHandler {
   private readonly dialogId: string;
   private readonly userId: number;
-  private readonly callbackSuccess: CallbackSuccess | null | undefined;
+  private readonly callbackSuccess?: CallbackSuccess;
 
   /**
    * Initializes the content remove handler.
    */
-  constructor(element: HTMLElement, userId: number, callbackSuccess?: CallbackSuccess | null) {
+  constructor(element: HTMLElement, userId: number, callbackSuccess?: CallbackSuccess) {
     this.userId = userId;
     this.dialogId = `userRemoveContentHandler-${this.userId}`;
     this.callbackSuccess = callbackSuccess;
index 9b8db74b35a2d2ea4ca9bc1aee02b939b57f674f..62d8d55c666d132f7cdaa5fff53e831b872b5e65 100644 (file)
@@ -66,34 +66,34 @@ class AcpUiUserEditor {
       });
     }
 
-    const deleteContent = dropdownMenu.querySelector(".jsDeleteContent") as HTMLAnchorElement;
+    const deleteContent = dropdownMenu.querySelector(".jsDeleteContent");
     if (deleteContent !== null) {
-      new AcpUserContentRemoveHandler(deleteContent, userId);
+      new AcpUserContentRemoveHandler(deleteContent as HTMLAnchorElement, userId);
     }
 
-    const sendNewPassword = dropdownMenu.querySelector(".jsSendNewPassword") as HTMLAnchorElement;
+    const sendNewPassword = dropdownMenu.querySelector(".jsSendNewPassword");
     if (sendNewPassword !== null) {
-      new SendNewPasswordAction(sendNewPassword, userId, userRow);
+      new SendNewPasswordAction(sendNewPassword as HTMLAnchorElement, userId, userRow);
     }
 
-    const toggleConfirmEmail = dropdownMenu.querySelector(".jsConfirmEmailToggle") as HTMLAnchorElement;
+    const toggleConfirmEmail = dropdownMenu.querySelector(".jsConfirmEmailToggle");
     if (toggleConfirmEmail !== null) {
-      new ToggleConfirmEmailAction(toggleConfirmEmail, userId, userRow);
+      new ToggleConfirmEmailAction(toggleConfirmEmail as HTMLAnchorElement, userId, userRow);
     }
 
-    const enableUser = dropdownMenu.querySelector(".jsEnable") as HTMLAnchorElement;
+    const enableUser = dropdownMenu.querySelector(".jsEnable");
     if (enableUser !== null) {
-      new DisableAction(enableUser, userId, userRow);
+      new DisableAction(enableUser as HTMLAnchorElement, userId, userRow);
     }
 
-    const banUser = dropdownMenu.querySelector(".jsBan") as HTMLAnchorElement;
+    const banUser = dropdownMenu.querySelector(".jsBan");
     if (banUser !== null) {
-      new BanAction(banUser, userId, userRow);
+      new BanAction(banUser as HTMLAnchorElement, userId, userRow);
     }
 
-    const deleteUser = dropdownMenu.querySelector(".jsDelete") as HTMLAnchorElement;
+    const deleteUser = dropdownMenu.querySelector(".jsDelete");
     if (deleteUser !== null) {
-      new DeleteAction(deleteUser, userId, userRow);
+      new DeleteAction(deleteUser as HTMLAnchorElement, userId, userRow);
     }
   }
 
diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Abstract.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Abstract.js
new file mode 100644 (file)
index 0000000..a6cf02a
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * An abstract action, to handle user actions.
+ *
+ * @author  Joshua Ruesweg
+ * @copyright  2001-2021 WoltLab GmbH
+ * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Acp/Ui/User/Action
+ * @since       5.5
+ */
+define(["require", "exports"], function (require, exports) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    exports.AbstractUserAction = void 0;
+    class AbstractUserAction {
+        constructor(button, userId, userDataElement) {
+            this.button = button;
+            this.userId = userId;
+            this.userDataElement = userDataElement;
+        }
+    }
+    exports.AbstractUserAction = AbstractUserAction;
+    exports.default = AbstractUserAction;
+});
index de99615fa0a0864021be0373de11378544584696..47163afb602106dccd96ee152dbcec0ba8d0079a 100644 (file)
@@ -1,21 +1,24 @@
 /**
+ * Handles a user ban button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
-define(["require", "exports", "tslib", "../../../../Core", "./AbstractUserAction", "./Handler/Ban", "../../../../Ui/Notification", "../../../../Event/Handler"], function (require, exports, tslib_1, Core, AbstractUserAction_1, Ban_1, UiNotification, EventHandler) {
+define(["require", "exports", "tslib", "../../../../Core", "./Abstract", "./Handler/Ban", "../../../../Ui/Notification", "../../../../Event/Handler"], function (require, exports, tslib_1, Core, Abstract_1, Ban_1, UiNotification, EventHandler) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.BanAction = void 0;
     Core = tslib_1.__importStar(Core);
-    AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
+    Abstract_1 = tslib_1.__importDefault(Abstract_1);
     Ban_1 = tslib_1.__importDefault(Ban_1);
     UiNotification = tslib_1.__importStar(UiNotification);
     EventHandler = tslib_1.__importStar(EventHandler);
-    class BanAction extends AbstractUserAction_1.default {
-        init() {
+    class BanAction extends Abstract_1.default {
+        constructor(button, userId, userDataElement) {
+            super(button, userId, userDataElement);
             this.banHandler = new Ban_1.default([this.userId]);
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
index dd726758d63adb152d583ef89061de075636d9e0..82e8533ee022f8f9b47508a59e4a155eadc227f1 100644 (file)
@@ -1,23 +1,26 @@
 /**
+ * Handles a user delete button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
-define(["require", "exports", "tslib", "./AbstractUserAction", "./Handler/Delete"], function (require, exports, tslib_1, AbstractUserAction_1, Delete_1) {
+define(["require", "exports", "tslib", "./Abstract", "./Handler/Delete"], function (require, exports, tslib_1, Abstract_1, Delete_1) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.DeleteAction = void 0;
-    AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
+    Abstract_1 = tslib_1.__importDefault(Abstract_1);
     Delete_1 = tslib_1.__importDefault(Delete_1);
-    class DeleteAction extends AbstractUserAction_1.default {
-        init() {
+    class DeleteAction extends Abstract_1.default {
+        constructor(button, userId, userDataElement) {
+            super(button, userId, userDataElement);
+            if (typeof this.button.dataset.confirmMessage !== "string") {
+                throw new Error("The button does not provide a confirmMessage.");
+            }
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
-                if (!(typeof this.button.dataset.confirmMessage === "string")) {
-                    throw new Error("The button does not provides a confirmMessage.");
-                }
                 const deleteHandler = new Delete_1.default([this.userId], () => {
                     this.userDataElement.remove();
                 }, this.button.dataset.confirmMessage);
index 19a37bee2244a7fa232127ac8a60074cbd41292a..5636c96eebbea2d7baa53fbed5f037f1afe4018d 100644 (file)
@@ -1,21 +1,24 @@
 /**
+ * Handles a user disable/enable button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
-define(["require", "exports", "tslib", "../../../../Ajax", "../../../../Core", "../../../../Ui/Notification", "./AbstractUserAction", "../../../../Event/Handler"], function (require, exports, tslib_1, Ajax, Core, UiNotification, AbstractUserAction_1, EventHandler) {
+define(["require", "exports", "tslib", "../../../../Ajax", "../../../../Core", "../../../../Ui/Notification", "./Abstract", "../../../../Event/Handler"], function (require, exports, tslib_1, Ajax, Core, UiNotification, Abstract_1, EventHandler) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.DisableAction = void 0;
     Ajax = tslib_1.__importStar(Ajax);
     Core = tslib_1.__importStar(Core);
     UiNotification = tslib_1.__importStar(UiNotification);
-    AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
+    Abstract_1 = tslib_1.__importDefault(Abstract_1);
     EventHandler = tslib_1.__importStar(EventHandler);
-    class DisableAction extends AbstractUserAction_1.default {
-        init() {
+    class DisableAction extends Abstract_1.default {
+        constructor(button, userId, userDataElement) {
+            super(button, userId, userDataElement);
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
                 const isEnabled = Core.stringToBool(this.userDataElement.dataset.enabled);
index 5da6793d650151029acbe45c340c434a6ef4fe98..34144ce2c08730d489934b672eb5b6ff620c926f 100644 (file)
@@ -1,22 +1,24 @@
 /**
+ * Handles a user ban.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action/Handler
  * @since       5.5
  */
-define(["require", "exports", "tslib", "../../../../../Ajax", "./Dialog/Ban"], function (require, exports, tslib_1, Ajax, Ban_1) {
+define(["require", "exports", "tslib", "../../../../../Ajax", "./Ban/Dialog"], function (require, exports, tslib_1, Ajax, Dialog_1) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.BanHandler = void 0;
     Ajax = tslib_1.__importStar(Ajax);
-    Ban_1 = tslib_1.__importDefault(Ban_1);
+    Dialog_1 = tslib_1.__importDefault(Dialog_1);
     class BanHandler {
         constructor(userIDs) {
             this.userIDs = userIDs;
         }
         ban(callback) {
-            Ban_1.default.open(this.userIDs, callback);
+            Dialog_1.default.open(this.userIDs, callback);
         }
         unban(callback) {
             Ajax.api({
@@ -29,7 +31,7 @@ define(["require", "exports", "tslib", "../../../../../Ajax", "./Dialog/Ban"], f
                         },
                     };
                 },
-                _ajaxSuccess: callback,
+                _ajaxSuccess: () => callback(),
             });
         }
     }
diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban/Dialog.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban/Dialog.js
new file mode 100644 (file)
index 0000000..43bd7f5
--- /dev/null
@@ -0,0 +1,129 @@
+/**
+ * Creates and handles the dialog to ban a user.
+ *
+ * @author  Joshua Ruesweg
+ * @copyright  2001-2021 WoltLab GmbH
+ * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban
+ * @since       5.5
+ */
+define(["require", "exports", "tslib", "../../../../../../Ui/Dialog", "../../../../../../Language", "../../../../../../Ajax", "../../../../../../Date/Picker"], function (require, exports, tslib_1, Dialog_1, Language, Ajax, Picker_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    exports.BanDialog = void 0;
+    Dialog_1 = tslib_1.__importDefault(Dialog_1);
+    Language = tslib_1.__importStar(Language);
+    Ajax = tslib_1.__importStar(Ajax);
+    Picker_1 = tslib_1.__importDefault(Picker_1);
+    class BanDialog {
+        static open(userIDs, callback) {
+            if (!BanDialog.instance) {
+                BanDialog.instance = new BanDialog();
+            }
+            BanDialog.instance.setCallback(callback);
+            BanDialog.instance.setUserIDs(userIDs);
+            BanDialog.instance.openDialog();
+        }
+        openDialog() {
+            Dialog_1.default.open(this);
+        }
+        setCallback(callback) {
+            this.banCallback = callback;
+        }
+        setUserIDs(userIDs) {
+            this.userIDs = userIDs;
+        }
+        banSubmit(reason, expires) {
+            Ajax.apiOnce({
+                data: {
+                    actionName: "ban",
+                    className: "wcf\\data\\user\\UserAction",
+                    objectIDs: this.userIDs,
+                    parameters: {
+                        banReason: reason,
+                        banExpires: expires,
+                    },
+                },
+                success: this.banCallback,
+            });
+        }
+        cleanupDialog() {
+            this.reasonInput.value = "";
+            this.neverExpiresCheckbox.checked = true;
+            Picker_1.default.clear("userBanExpires");
+            this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
+        }
+        _dialogSetup() {
+            return {
+                id: "userBanHandler",
+                options: {
+                    onSetup: (content) => {
+                        this.dialogContent = content;
+                        this.submitElement = content.querySelector(".formSubmitButton");
+                        this.reasonInput = content.querySelector("#userBanReason");
+                        this.neverExpiresCheckbox = content.querySelector("#userBanNeverExpires");
+                        this.userBanExpiresSettingsElement = content.querySelector("#userBanExpiresSettings");
+                        this.submitElement.addEventListener("click", (event) => {
+                            event.preventDefault();
+                            const expires = this.neverExpiresCheckbox.checked ? "" : Picker_1.default.getValue("userBanExpires");
+                            this.banSubmit(this.reasonInput.value, expires);
+                            Dialog_1.default.close(this);
+                            this.cleanupDialog();
+                        });
+                        this.neverExpiresCheckbox.addEventListener("change", (event) => {
+                            const checkbox = event.currentTarget;
+                            if (checkbox.checked) {
+                                this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
+                            }
+                            else {
+                                this.userBanExpiresSettingsElement.style.removeProperty("display");
+                            }
+                        });
+                    },
+                    title: Language.get("wcf.acp.user.ban.sure"),
+                },
+                source: `
+ <div class="section">
+   <dl>
+     <dt><label for="userBanReason">${Language.get("wcf.acp.user.banReason")}</label></dt>
+     <dd>
+       <textarea id="userBanReason" cols="40" rows="3" class=""></textarea>
+       <small>${Language.get("wcf.acp.user.banReason.description")}</small>
+     </dd>
+   </dl>
+   <dl>
+     <dt></dt>
+     <dd>
+       <label for="userBanNeverExpires">
+         <input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
+         ${Language.get("wcf.acp.user.ban.neverExpires")}
+       </label>
+     </dd>
+   </dl>
+   <dl id="userBanExpiresSettings" style="display: none;">
+     <dt>
+       <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
+     </dt>
+     <dd>
+       <div class="inputAddon">
+         <input  type="date"
+                 name="userBanExpires"
+                 id="userBanExpires"
+                 class="medium"
+                 min="${new Date(window.TIME_NOW * 1000).toISOString()}"
+                 data-ignore-timezone="true"
+         />
+       </div>
+       <small>${Language.get("wcf.acp.user.ban.expires.description")}</small>
+     </dd>
+   </dl>
+ </div>
+ <div class="formSubmit dialogFormSubmit">
+   <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get("wcf.global.button.submit")}</button>
+ </div>`,
+            };
+        }
+    }
+    exports.BanDialog = BanDialog;
+    exports.default = BanDialog;
+});
index 076cadf88769ba40ecfe108c876f45f24149e980..61d6c30e8e9b60004bba414772d1f778c6860667 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Deletes a given user.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.js
deleted file mode 100644 (file)
index aec65ef..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * @author  Joshua Ruesweg
- * @copyright  2001-2021 WoltLab GmbH
- * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module  WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog
- * @since       5.5
- */
-define(["require", "exports", "tslib", "../../../../../../Ui/Dialog", "../../../../../../Language", "../../../../../../Ajax", "../../../../../../Date/Picker"], function (require, exports, tslib_1, Dialog_1, Language, Ajax, Picker_1) {
-    "use strict";
-    Object.defineProperty(exports, "__esModule", { value: true });
-    exports.BanDialog = void 0;
-    Dialog_1 = tslib_1.__importDefault(Dialog_1);
-    Language = tslib_1.__importStar(Language);
-    Ajax = tslib_1.__importStar(Ajax);
-    Picker_1 = tslib_1.__importDefault(Picker_1);
-    class BanDialog {
-        static open(userIDs, callback) {
-            if (!BanDialog.instance) {
-                BanDialog.instance = new BanDialog();
-            }
-            BanDialog.instance.setCallback(callback);
-            BanDialog.instance.setUserIDs(userIDs);
-            BanDialog.instance.openDialog();
-        }
-        openDialog() {
-            Dialog_1.default.open(this);
-        }
-        setCallback(callback) {
-            this.banCallback = callback;
-        }
-        setUserIDs(userIDs) {
-            this.userIDs = userIDs;
-        }
-        banSubmit(reason, expires) {
-            Ajax.apiOnce({
-                data: {
-                    actionName: "ban",
-                    className: "wcf\\data\\user\\UserAction",
-                    objectIDs: this.userIDs,
-                    parameters: {
-                        banReason: reason,
-                        banExpires: expires,
-                    },
-                },
-                success: this.banCallback,
-            });
-        }
-        cleanupDialog() {
-            this.reasonInput.value = "";
-            this.neverExpiresCheckbox.checked = true;
-            Picker_1.default.clear("userBanExpires");
-            this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
-        }
-        _dialogSetup() {
-            return {
-                id: "userBanHandler",
-                options: {
-                    onSetup: (content) => {
-                        this.dialogContent = content;
-                        this.submitElement = content.querySelector(".formSubmitButton");
-                        this.reasonInput = content.querySelector("#userBanReason");
-                        this.neverExpiresCheckbox = content.querySelector("#userBanNeverExpires");
-                        this.userBanExpiresSettingsElement = content.querySelector("#userBanExpiresSettings");
-                        this.submitElement.addEventListener("click", (event) => {
-                            event.preventDefault();
-                            const expires = this.neverExpiresCheckbox.checked ? "" : Picker_1.default.getValue("userBanExpires");
-                            this.banSubmit(this.reasonInput.value, expires);
-                            Dialog_1.default.close(this);
-                            this.cleanupDialog();
-                        });
-                        this.neverExpiresCheckbox.addEventListener("change", (event) => {
-                            const checkbox = event.currentTarget;
-                            if (checkbox.checked) {
-                                this.userBanExpiresSettingsElement.style.setProperty("display", "none", "");
-                            }
-                            else {
-                                this.userBanExpiresSettingsElement.style.removeProperty("display");
-                            }
-                        });
-                    },
-                    title: Language.get("wcf.acp.user.ban.sure"),
-                },
-                source: `
-<div class="section">
-  <dl>
-    <dt><label for="userBanReason">${Language.get("wcf.acp.user.banReason")}</label></dt>
-    <dd>
-      <textarea id="userBanReason" cols="40" rows="3" class=""></textarea>
-      <small>${Language.get("wcf.acp.user.banReason.description")}</small>
-    </dd>
-  </dl>
-  <dl>
-    <dt></dt>
-    <dd>
-      <label for="userBanNeverExpires">
-        <input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
-        ${Language.get("wcf.acp.user.ban.neverExpires")}
-      </label>
-    </dd>
-  </dl>
-  <dl id="userBanExpiresSettings" style="display: none;">
-    <dt>
-      <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
-    </dt>
-    <dd>
-      <div class="inputAddon">
-        <input  type="date"
-                name="userBanExpires"
-                id="userBanExpires"
-                class="medium"
-                min="${new Date(window.TIME_NOW * 1000).toISOString()}"
-                data-ignore-timezone="true"
-        />
-      </div>
-      <small>${Language.get("wcf.acp.user.ban.expires.description")}</small>
-    </dd>
-  </dl>
-</div>
-<div class="formSubmit dialogFormSubmit">
-  <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get("wcf.global.button.submit")}</button>
-</div>`,
-            };
-        }
-    }
-    exports.BanDialog = BanDialog;
-    exports.default = BanDialog;
-});
index 929e785b0ae057ea1c46f71b91bcf84335735e3b..0bb45be553bcd3f61bbfcdb636841f1341a4a8b1 100644 (file)
@@ -1,4 +1,6 @@
 /**
+ * Handles a send new password action.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
index b75cfdb6dfedc4167e2b79fbc68cfef614696d5d..9f61c127aa0ff801de25310ca4b0b5a71f9372cd 100644 (file)
@@ -1,18 +1,21 @@
 /**
+ * Handles a send new password button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
-define(["require", "exports", "tslib", "./AbstractUserAction", "./Handler/SendNewPassword"], function (require, exports, tslib_1, AbstractUserAction_1, SendNewPassword_1) {
+define(["require", "exports", "tslib", "./Abstract", "./Handler/SendNewPassword"], function (require, exports, tslib_1, Abstract_1, SendNewPassword_1) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.SendNewPasswordAction = void 0;
-    AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
+    Abstract_1 = tslib_1.__importDefault(Abstract_1);
     SendNewPassword_1 = tslib_1.__importDefault(SendNewPassword_1);
-    class SendNewPasswordAction extends AbstractUserAction_1.default {
-        init() {
+    class SendNewPasswordAction extends Abstract_1.default {
+        constructor(button, userId, userDataElement) {
+            super(button, userId, userDataElement);
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
                 const sendNewPasswordHandler = new SendNewPassword_1.default([this.userId], () => {
index 3ca6146c9ca00c6ed55b12ab3d89fcaabab44002..242b9e285bd78c2e5480c4cd1cf4d5f17f1c50ab 100644 (file)
@@ -1,25 +1,28 @@
 /**
+ * Handles a toggle confirm email button.
+ *
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
  * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
-define(["require", "exports", "tslib", "./AbstractUserAction", "../../../../Ajax", "../../../../Core", "../../../../Ui/Notification"], function (require, exports, tslib_1, AbstractUserAction_1, Ajax, Core, UiNotification) {
+define(["require", "exports", "tslib", "./Abstract", "../../../../Ajax", "../../../../Core", "../../../../Ui/Notification"], function (require, exports, tslib_1, Abstract_1, Ajax, Core, UiNotification) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.ToggleConfirmEmailAction = void 0;
-    AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
+    Abstract_1 = tslib_1.__importDefault(Abstract_1);
     Ajax = tslib_1.__importStar(Ajax);
     Core = tslib_1.__importStar(Core);
     UiNotification = tslib_1.__importStar(UiNotification);
-    class ToggleConfirmEmailAction extends AbstractUserAction_1.default {
-        init() {
+    class ToggleConfirmEmailAction extends Abstract_1.default {
+        constructor(button, userId, userDataElement) {
+            super(button, userId, userDataElement);
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
                 const isEmailConfirmed = Core.stringToBool(this.userDataElement.dataset.emailConfirmed);
                 Ajax.api(this, {
-                    actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
+                    actionName: isEmailConfirmed ? "unconfirmEmail" : "confirmEmail",
                 });
             });
         }