Fix codestyle
authorjoshuaruesweg <ruesweg@woltlab.com>
Mon, 28 Jun 2021 15:13:57 +0000 (17:13 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Wed, 30 Jun 2021 13:22:44 +0000 (15:22 +0200)
21 files changed:
ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts
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/Delete.ts
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/Editor.ts
wcfsetup/install/files/acp/templates/userAdd.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.js
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/Delete.js
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
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Editor.js

index 4537cda04477db2297fc82dfe824063c3c24f4c7..75a3ace37f00ab7610f64eb3f545a1325be3938c 100644 (file)
@@ -1,17 +1,25 @@
+/**
+ * @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 button: HTMLElement;
-  protected userData: HTMLElement;
-  protected userId: number;
+  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.userData = userDataElement;
+    this.userDataElement = userDataElement;
 
     this.init();
   }
 
-  protected abstract init();
+  protected abstract init(): void;
 }
 
 export default AbstractUserAction;
index ab70349d7546806a6be4ec01c7eebb614562a1ba..6085667bac9e7aa1fedcb407ba8939e09705732f 100644 (file)
@@ -1,9 +1,3 @@
-import * as Core from "../../../../Core";
-import AbstractUserAction from "./AbstractUserAction";
-import BanHandler from "./Handler/Ban";
-import * as UiNotification from "../../../../Ui/Notification";
-import * as EventHandler from "../../../../Event/Handler";
-
 /**
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
@@ -11,38 +5,44 @@ import * as EventHandler from "../../../../Event/Handler";
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
+
+import * as Core from "../../../../Core";
+import AbstractUserAction from "./AbstractUserAction";
+import BanHandler from "./Handler/Ban";
+import * as UiNotification from "../../../../Ui/Notification";
+import * as EventHandler from "../../../../Event/Handler";
+
 export class BanAction extends AbstractUserAction {
   private banHandler: BanHandler;
 
-  protected init() {
+  protected init(): void {
     this.banHandler = new BanHandler([this.userId]);
 
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
 
-      const isBanned = Core.stringToBool(this.userData.dataset.banned!);
+      const isBanned = Core.stringToBool(this.userDataElement.dataset.banned!);
 
       if (isBanned) {
         this.banHandler.unban(() => {
-          this.userData.dataset.banned = "false";
+          this.userDataElement.dataset.banned = "false";
           this.button.textContent = this.button.dataset.banMessage!;
 
           UiNotification.show();
 
           EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
-            userIds: [this.userId]
+            userIds: [this.userId],
           });
         });
-      }
-      else {
+      } else {
         this.banHandler.ban(() => {
-          this.userData.dataset.banned = "true";
+          this.userDataElement.dataset.banned = "true";
           this.button.textContent = this.button.dataset.unbanMessage!;
 
           UiNotification.show();
 
           EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
-            userIds: [this.userId]
+            userIds: [this.userId],
           });
         });
       }
index 559527d5dd2a124fe8c58210c551a1e6e9df41ce..c2d4dfeeaf9ab21c4c9d85b3e2df98509ee437ad 100644 (file)
@@ -1,7 +1,3 @@
-import AbstractUserAction from "./AbstractUserAction";
-import * as Language from "../../../../Language";
-import Delete from "./Handler/Delete";
-
 /**
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
@@ -9,14 +5,22 @@ import Delete from "./Handler/Delete";
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
+
+import AbstractUserAction from "./AbstractUserAction";
+import Delete from "./Handler/Delete";
+
 export class DeleteAction extends AbstractUserAction {
-  protected init() {
+  protected init(): void {
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
 
-      let deleteHandler = new Delete([this.userId], () => {
-        this.userData.remove();
-      }, this.button.dataset.confirmMessage);
+      const deleteHandler = new Delete(
+        [this.userId],
+        () => {
+          this.userDataElement.remove();
+        },
+        this.button.dataset.confirmMessage,
+      );
       deleteHandler.delete();
     });
   }
index f132404333ca7e8d096f95430078106711ba1d5a..8fddd1c0f3a374f9d0b6490b3ecd0b09e3959307 100644 (file)
@@ -1,10 +1,3 @@
-import * as Ajax from "../../../../Ajax";
-import * as Core from "../../../../Core";
-import { AjaxCallbackObject, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
-import * as UiNotification from "../../../../Ui/Notification";
-import AbstractUserAction from "./AbstractUserAction";
-import * as EventHandler from "../../../../Event/Handler";
-
 /**
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
@@ -12,51 +5,57 @@ import * as EventHandler from "../../../../Event/Handler";
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
-export class DisableAction extends AbstractUserAction {
-  protected init() {
+
+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 * as EventHandler from "../../../../Event/Handler";
+
+export class DisableAction extends AbstractUserAction implements AjaxCallbackObject {
+  protected init(): void {
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
+      const isEnabled = Core.stringToBool(this.userDataElement.dataset.enabled!);
 
-      Ajax.api(
-        {
-          _ajaxSetup: () => {
-            const isEnabled = Core.stringToBool(this.userData.dataset.enabled!);
+      Ajax.api(this, {
+        actionName: isEnabled ? "disable" : "enable",
+      });
+    });
+  }
 
-            return {
-              data: {
-                actionName: (isEnabled ? "disable" : "enable"),
-                className: "wcf\\data\\user\\UserAction",
-                objectIDs: [this.userId],
-              },
-            };
-          },
+  _ajaxSetup(): ReturnType<AjaxCallbackSetup> {
+    return {
+      data: {
+        className: "wcf\\data\\user\\UserAction",
+        objectIDs: [this.userId],
+      },
+    };
+  }
 
-          _ajaxSuccess: (data: DatabaseObjectActionResponse) => {
-            if (data.objectIDs.includes(this.userId)) {
-              switch (data.actionName) {
-                case "enable":
-                  this.userData.dataset.enabled = "true";
-                  this.button.textContent = this.button.dataset.disableMessage!;
-                  break;
+  _ajaxSuccess(data: DatabaseObjectActionResponse): void {
+    if (data.objectIDs.includes(this.userId)) {
+      switch (data.actionName) {
+        case "enable":
+          this.userDataElement.dataset.enabled = "true";
+          this.button.textContent = this.button.dataset.disableMessage!;
+          break;
 
-                case "disable":
-                  this.userData.dataset.enabled = "false";
-                  this.button.textContent = this.button.dataset.enableMessage!;
-                  break;
+        case "disable":
+          this.userDataElement.dataset.enabled = "false";
+          this.button.textContent = this.button.dataset.enableMessage!;
+          break;
 
-                default:
-                  throw new Error("Unreachable");
-              }
-            }
+        default:
+          throw new Error("Unreachable");
+      }
+    }
 
-            UiNotification.show();
+    UiNotification.show();
 
-            EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
-              userIds: [this.userId]
-            });
-          },
-        }
-      );
+    EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
+      userIds: [this.userId],
     });
   }
 }
index b5654d755da1e4f8b510596b840211a24b3101b6..06c288ae248661a553a7a77fe04db573258fa33d 100644 (file)
@@ -1,9 +1,3 @@
-import { DialogCallbackSetup } from "../../../../../Ui/Dialog/Data";
-import * as Language from "../../../../../Language";
-import * as Ajax from "../../../../../Ajax";
-import { AjaxCallbackObject, DatabaseObjectActionResponse } from "../../../../../Ajax/Data";
-import UiDialog from "../../../../../Ui/Dialog";
-
 /**
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
@@ -11,104 +5,105 @@ import UiDialog from "../../../../../Ui/Dialog";
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action/Handler
  * @since       5.5
  */
+
+import { DialogCallbackSetup } from "../../../../../Ui/Dialog/Data";
+import * as Language from "../../../../../Language";
+import * as Ajax from "../../../../../Ajax";
+import UiDialog from "../../../../../Ui/Dialog";
+
 export class BanHandler {
-      private userIDs: number[];
-      private banCallback: () => void;
+  private userIDs: number[];
+  private banCallback: () => void;
 
-      public constructor(userIDs: number[]) {
-        this.userIDs = userIDs;
-      }
+  public constructor(userIDs: number[]) {
+    this.userIDs = userIDs;
+  }
 
-      ban(callback: () => void): void {
-        // Save the callback for later usage.
-        // We cannot easily give the callback to the dialog.
-        this.banCallback = callback;
+  public ban(callback: () => void): void {
+    // Save the callback for later usage.
+    // We cannot easily give the callback to the dialog.
+    this.banCallback = callback;
 
-        UiDialog.open(this);
-      }
+    UiDialog.open(this);
+  }
 
-      unban(callback: () => void): void {
-        Ajax.api(
-          {
-            _ajaxSetup: () => {
-              return {
-                data: {
-                  actionName: "unban",
-                  className: "wcf\\data\\user\\UserAction",
-                  objectIDs: this.userIDs,
-                },
-              };
-            },
-            _ajaxSuccess: callback,
-          }
-        );
-      }
+  public unban(callback: () => void): void {
+    Ajax.api({
+      _ajaxSetup: () => {
+        return {
+          data: {
+            actionName: "unban",
+            className: "wcf\\data\\user\\UserAction",
+            objectIDs: this.userIDs,
+          },
+        };
+      },
+      _ajaxSuccess: callback,
+    });
+  }
 
-      private banSubmit(reason: string, userBanExpires: string): void {
-        Ajax.api(
-          {
-            _ajaxSetup: () => {
-              return {
-                data: {
-                  actionName: "ban",
-                  className: "wcf\\data\\user\\UserAction",
-                  objectIDs: this.userIDs,
-                  parameters: {
-                    'banReason': reason,
-                    'banExpires': userBanExpires,
-                  },
-                },
-              };
+  private banSubmit(reason: string, userBanExpires: string): void {
+    Ajax.api({
+      _ajaxSetup: () => {
+        return {
+          data: {
+            actionName: "ban",
+            className: "wcf\\data\\user\\UserAction",
+            objectIDs: this.userIDs,
+            parameters: {
+              banReason: reason,
+              banExpires: userBanExpires,
             },
-            _ajaxSuccess: this.banCallback,
-          }
-        );
-      }
+          },
+        };
+      },
+      _ajaxSuccess: this.banCallback,
+    });
+  }
 
-      _dialogSetup(): ReturnType<DialogCallbackSetup> {
-        return {
-          id: "userBanHandler",
-          options: {
-            onShow: (content: HTMLElement): void => {
-              const submit = content.querySelector(".formSubmitButton")! as HTMLElement;
-              const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
-              const userBanExpiresSettings = content.querySelector("#userBanExpiresSettings")! as HTMLElement;
+  _dialogSetup(): ReturnType<DialogCallbackSetup> {
+    return {
+      id: "userBanHandler",
+      options: {
+        onSetup: (content: HTMLElement): void => {
+          const submit = content.querySelector(".formSubmitButton")! as HTMLElement;
+          const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
+          const userBanExpiresSettings = content.querySelector("#userBanExpiresSettings")! as HTMLElement;
 
-              submit.addEventListener("click", (event) => {
-                event.preventDefault();
+          submit.addEventListener("click", (event) => {
+            event.preventDefault();
 
-                const reason = content.querySelector("#userBanReason")! as HTMLInputElement;
-                const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
-                const userBanExpires = content.querySelector("#userBanExpiresDatePicker")! as HTMLInputElement;
+            const reason = content.querySelector("#userBanReason")! as HTMLInputElement;
+            const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
+            const userBanExpires = content.querySelector("#userBanExpiresDatePicker")! as HTMLInputElement;
 
-                this.banSubmit(reason.value, neverExpires.checked ? "" : userBanExpires.value);
+            this.banSubmit(reason.value, neverExpires.checked ? "" : userBanExpires.value);
 
-                UiDialog.close(this);
+            UiDialog.close(this);
 
-                reason.value = "";
-                neverExpires.checked = true;
-                // @TODO empty userBanExpires
-                userBanExpiresSettings.style.setProperty("display", "none", "");
-              });
+            reason.value = "";
+            neverExpires.checked = true;
+            // @TODO empty userBanExpires
+            userBanExpiresSettings.style.setProperty("display", "none", "");
+          });
 
-              neverExpires.addEventListener("change", (event) => {
-                const checkbox = event.currentTarget as HTMLInputElement;
-                if (checkbox.checked) {
-                  userBanExpiresSettings.style.setProperty("display", "none", "");
-                }
-                else {
-                  userBanExpiresSettings.style.removeProperty("display");
-                }
-              });
-            },
-            title: Language.get('wcf.acp.user.ban.sure'),
-          },
-          source: `<div class="section">
+          neverExpires.addEventListener("change", (event) => {
+            const checkbox = event.currentTarget as HTMLInputElement;
+            if (checkbox.checked) {
+              userBanExpiresSettings.style.setProperty("display", "none", "");
+            } else {
+              userBanExpiresSettings.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>
+              <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>
+                <small>${Language.get("wcf.acp.user.banReason.description")}</small>
               </dd>
             </dl>
             <dl>
@@ -116,13 +111,13 @@ export class BanHandler {
               <dd>
                 <label for="userBanNeverExpires">
                   <input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
-                  ${Language.get('wcf.acp.user.ban.neverExpires')}
+                  ${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>
+                <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
               </dt>
               <dd>
                 <div class="inputAddon">
@@ -134,15 +129,17 @@ export class BanHandler {
                           data-ignore-timezone="true"
                   />
                 </div>
-                <small>${Language.get('wcf.acp.user.ban.expires.description')}</small>
+                <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>
+            <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get(
+              "wcf.global.button.submit",
+            )}</button>
           </div>`,
-        };
-    }
+    };
+  }
 }
 
-export default BanHandler;
\ No newline at end of file
+export default BanHandler;
index 3a6a58abd1a2aafa3e673eb89b4d511e3125de6b..5edebe6722560383fbcf9808f32200a4d80e9049 100644 (file)
@@ -1,8 +1,3 @@
-import * as Language from "../../../../../Language";
-import * as UiConfirmation from "../../../../../Ui/Confirmation";
-import * as Ajax from "../../../../../Ajax";
-import { CallbackSuccess } from "../../../../../Ajax/Data";
-
 /**
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
@@ -10,6 +5,12 @@ import { CallbackSuccess } from "../../../../../Ajax/Data";
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action/Handler
  * @since       5.5
  */
+
+import * as Language from "../../../../../Language";
+import * as UiConfirmation from "../../../../../Ui/Confirmation";
+import * as Ajax from "../../../../../Ajax";
+import { CallbackSuccess } from "../../../../../Ajax/Data";
+
 export class Delete {
   private userIDs: number[];
   private successCallback: CallbackSuccess;
@@ -20,29 +21,22 @@ export class Delete {
     this.successCallback = successCallback;
     if (deleteMessage) {
       this.deleteMessage = deleteMessage;
-    }
-    else {
+    } else {
       this.deleteMessage = Language.get("wcf.button.delete.confirmMessage"); // @todo find better variable for a generic message
     }
   }
 
-  delete(): void {
+  public delete(): void {
     UiConfirmation.show({
       confirm: () => {
-        Ajax.api(
-          {
-            _ajaxSetup: () => {
-              return {
-                data: {
-                  actionName: "delete",
-                  className: "wcf\\data\\user\\UserAction",
-                  objectIDs: this.userIDs,
-                },
-              };
-            },
-            _ajaxSuccess: this.successCallback,
-          }
-        );
+        Ajax.apiOnce({
+          data: {
+            actionName: "delete",
+            className: "wcf\\data\\user\\UserAction",
+            objectIDs: this.userIDs,
+          },
+          success: this.successCallback,
+        });
       },
       message: this.deleteMessage,
       messageIsHtml: true,
index 4dc42b290171dead1eaf17d63f2679ef48ecbb31..0578c44e9d8fe6cddf80356c33e04a5f6dab703d 100644 (file)
@@ -1,3 +1,11 @@
+/**
+ * @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
+ */
+
 import * as Language from "../../../../../Language";
 import * as UiConfirmation from "../../../../../Ui/Confirmation";
 import AcpUiWorker from "../../../Worker";
@@ -12,13 +20,6 @@ interface AjaxResponse {
 
 type CallbackSuccess = (data: AjaxResponse) => void;
 
-/**
- * @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
- */
 export class SendNewPassword {
   private userIDs: number[];
   private successCallback: CallbackSuccess | null;
index 9bfde2d23955cfd16b3f7997a7c5ddb828b79de4..9e2024a2795e526f372bc8d5b86cba9e98609294 100644 (file)
@@ -1,6 +1,3 @@
-import AbstractUserAction from "./AbstractUserAction";
-import SendNewPassword from "./Handler/SendNewPassword";
-
 /**
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
@@ -8,8 +5,12 @@ import SendNewPassword from "./Handler/SendNewPassword";
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
+
+import AbstractUserAction from "./AbstractUserAction";
+import SendNewPassword from "./Handler/SendNewPassword";
+
 export class SendNewPasswordAction extends AbstractUserAction {
-  protected init() {
+  protected init(): void {
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
 
index 1b7851a5f17e1018f51d3e0fb45e40db3dabd0ae..ec24798587f65eed96bbc82811430ffcd816e658 100644 (file)
@@ -1,9 +1,3 @@
-import AbstractUserAction from "./AbstractUserAction";
-import * as Ajax from "../../../../Ajax";
-import * as Core from "../../../../Core";
-import { AjaxCallbackObject, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
-import * as UiNotification from "../../../../Ui/Notification";
-
 /**
  * @author  Joshua Ruesweg
  * @copyright  2001-2021 WoltLab GmbH
@@ -11,49 +5,54 @@ import * as UiNotification from "../../../../Ui/Notification";
  * @module  WoltLabSuite/Core/Acp/Ui/User/Action
  * @since       5.5
  */
+
+import AbstractUserAction from "./AbstractUserAction";
+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() {
+  protected init(): void {
     this.button.addEventListener("click", (event) => {
       event.preventDefault();
+      const isEmailConfirmed = Core.stringToBool(this.userDataElement.dataset.emailConfirmed!);
 
-      Ajax.api(
-        {
-          _ajaxSetup: () => {
-            const isEmailConfirmed = Core.stringToBool(this.userData.dataset.emailConfirmed!);
-
-            return {
-              data: {
-                actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
-                className: "wcf\\data\\user\\UserAction",
-                objectIDs: [this.userId],
-              },
-            };
-          },
-
-          _ajaxSuccess: (data: DatabaseObjectActionResponse) => {
-            if (data.objectIDs.includes(this.userId)) {
-              switch (data.actionName) {
-                case "confirmEmail":
-                  this.userData.dataset.emailConfirmed = "true";
-                  this.button.textContent = this.button.dataset.unconfirmEmailMessage!;
-                  break;
-
-                case "unconfirmEmail":
-                  this.userData.dataset.emailConfirmed = "false";
-                  this.button.textContent = this.button.dataset.confirmEmailMessage!;
-                  break;
-
-                default:
-                  throw new Error("Unreachable");
-              }
-            }
-
-            UiNotification.show();
-          },
-        }
-      );
+      Ajax.api(this, {
+        actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
+      });
     });
   }
+
+  _ajaxSetup(): ReturnType<AjaxCallbackSetup> {
+    return {
+      data: {
+        className: "wcf\\data\\user\\UserAction",
+        objectIDs: [this.userId],
+      },
+    };
+  }
+
+  _ajaxSuccess(data: DatabaseObjectActionResponse): void {
+    if (data.objectIDs.includes(this.userId)) {
+      switch (data.actionName) {
+        case "confirmEmail":
+          this.userDataElement.dataset.emailConfirmed = "true";
+          this.button.textContent = this.button.dataset.unconfirmEmailMessage!;
+          break;
+
+        case "unconfirmEmail":
+          this.userDataElement.dataset.emailConfirmed = "false";
+          this.button.textContent = this.button.dataset.confirmEmailMessage!;
+          break;
+
+        default:
+          throw new Error("Unreachable");
+      }
+    }
+
+    UiNotification.show();
+  }
 }
 
 export default ToggleConfirmEmailAction;
index 406d795eec933c523b3a7e43a8ba145ff9720152..9b8db74b35a2d2ea4ca9bc1aee02b939b57f674f 100644 (file)
@@ -106,7 +106,6 @@ class AcpUiUserEditor {
 
     // inject buttons
     const items: HTMLLIElement[] = [];
-    let deleteButton: HTMLAnchorElement | null = null;
     Array.from(legacyButtonContainer.children).forEach((button: HTMLAnchorElement) => {
       const item = document.createElement("li");
       item.className = "jsLegacyItem";
@@ -181,4 +180,4 @@ class AcpUiUserEditor {
   }
 }
 
-export = AcpUiUserEditor;
\ No newline at end of file
+export = AcpUiUserEditor;
index 1da5e151ef744bd42c02caac192aba597f23f20d..5b6e39c190a44a4fee5bb9350980bc9cc85ab7e6 100644 (file)
                <ul>
                        {if $action === 'edit'}
                                <li>
-                                       <div    class="dropdown"
-                                                       id="userListDropdown{@$user->userID}"
-                                                       data-object-id="{@$user->getObjectID()}"
-                                                       data-banned="{if $user->banned}true{else}false{/if}"
-                                                       data-enabled="{if !$user->activationCode}true{else}false{/if}"
-                                                       data-email-confirmed="{if $user->isEmailConfirmed()}true{else}false{/if}"
-                                       >
-                                               <a href="#" class="dropdownToggle button"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.global.button.edit{/lang}</span></a>
+                                       <div    class="dropdown"{*
+                                                       *}id="userListDropdown{@$user->userID}" {*
+                                                       *}data-object-id="{@$user->getObjectID()}" {*
+                                                       *}data-banned="{if $user->banned}true{else}false{/if}" {*
+                                                       *}data-enabled="{if !$user->activationCode}true{else}false{/if}" {*
+                                                       *}data-email-confirmed="{if $user->isEmailConfirmed()}true{else}false{/if}" {*
+                                       *}>
+                                               <a href="#" class="dropdownToggle button">
+                                                       <span class="icon icon16 fa-pencil"></span>
+                                                       <span>{lang}wcf.global.button.edit{/lang}</span>
+                                               </a>
 
                                                <ul class="dropdownMenu">
                                                        {event name='dropdownItems'}
 
                                                        {if $user->userID !== $__wcf->user->userID}
                                                                {if $__wcf->session->getPermission('admin.user.canEnableUser')}
-                                                                       <li><a href="#" class="jsEnable" data-enable-message="{lang}wcf.acp.user.enable{/lang}" data-disable-message="{lang}wcf.acp.user.disable{/lang}">{lang}wcf.acp.user.{if !$user->activationCode}disable{else}enable{/if}{/lang}</a></li>
+                                                                       <li>
+                                                                               <a {*
+                                                                               *}href="#" {*
+                                                                               *}class="jsEnable" {*
+                                                                               *}data-enable-message="{lang}wcf.acp.user.enable{/lang}" {*
+                                                                               *}data-disable-message="{lang}wcf.acp.user.disable{/lang}"{*
+                                                                               *}>
+                                                                                       {lang}wcf.acp.user.{if !$user->activationCode}disable{else}enable{/if}{/lang}
+                                                                               </a>
+                                                                       </li>
                                                                {/if}
 
                                                                {if $__wcf->session->getPermission('admin.user.canEnableUser')}
-                                                                       <li><a href="#" class="jsConfirmEmailToggle" data-confirm-email-message="{lang}wcf.acp.user.action.confirmEmail{/lang}" data-unconfirm-email-message="{lang}wcf.acp.user.action.unconfirmEmail{/lang}">{lang}wcf.acp.user.action.{if $user->isEmailConfirmed()}un{/if}confirmEmail{/lang}</a></li>
+                                                                       <li>
+                                                                               <a href="#" {*
+                                                                               *}class="jsConfirmEmailToggle" {*
+                                                                               *}data-confirm-email-message="{lang}wcf.acp.user.action.confirmEmail{/lang}" {*
+                                                                               *}data-unconfirm-email-message="{lang}wcf.acp.user.action.unconfirmEmail{/lang}"{*
+                                                                               *}>
+                                                                                       {lang}wcf.acp.user.action.{if $user->isEmailConfirmed()}un{/if}confirmEmail{/lang}
+                                                                               </a>
+                                                                       </li>
                                                                {/if}
 
                                                                {if $__wcf->session->getPermission('admin.user.canMailUser')}
-                                                                       <li><a href="{link controller='UserMail' id=$user->userID}{/link}">{lang}wcf.acp.user.action.sendMail{/lang}</a></li>
+                                                                       <li>
+                                                                               <a {*
+                                                                               *}href="{link controller='UserMail' id=$user->userID}{/link}"{*
+                                                                               *}>
+                                                                                       {lang}wcf.acp.user.action.sendMail{/lang}
+                                                                               </a>
+                                                                       </li>
                                                                {/if}
 
                                                                {if $__wcf->session->getPermission('admin.user.canEditPassword')}
-                                                                       <li><a href="#" class="jsSendNewPassword">{lang}wcf.acp.user.action.sendNewPassword{/lang}</a></li>
+                                                                       <li>
+                                                                               <a {*
+                                                                               *}href="#" {*
+                                                                               *}class="jsSendNewPassword"{*
+                                                                               *}>
+                                                                                       {lang}wcf.acp.user.action.sendNewPassword{/lang}
+                                                                               </a>
+                                                                       </li>
                                                                {/if}
                                                        {/if}
 
                                                        {if $__wcf->session->getPermission('admin.user.canExportGdprData')}
-                                                               <li><a href="{link controller='UserExportGdpr' id=$user->userID}{/link}">{lang}wcf.acp.user.exportGdpr{/lang}</a></li>
+                                                               <li
+                                                                       <a {*
+                                                                               *}href="{link controller='UserExportGdpr' id=$user->userID}{/link}"{*
+                                                                               *}>
+                                                                               {lang}wcf.acp.user.exportGdpr{/lang}
+                                                                       </a>
+                                                               </li>
                                                        {/if}
 
                                                        {if $__wcf->session->getPermission('admin.user.canDeleteUser')}
index 1bc3ee19869e64a378af118fee1ca97d77a7fe6d..a186ebf7b56ff18884d8ce1bb57d162083a59a11 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * @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 });
@@ -6,7 +13,7 @@ define(["require", "exports"], function (require, exports) {
         constructor(button, userId, userDataElement) {
             this.button = button;
             this.userId = userId;
-            this.userData = userDataElement;
+            this.userDataElement = userDataElement;
             this.init();
         }
     }
index 137e010c66e16bcfeed53215daffe6c26c3df9e7..de99615fa0a0864021be0373de11378544584696 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * @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) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,36 +14,29 @@ define(["require", "exports", "tslib", "../../../../Core", "./AbstractUserAction
     Ban_1 = tslib_1.__importDefault(Ban_1);
     UiNotification = tslib_1.__importStar(UiNotification);
     EventHandler = tslib_1.__importStar(EventHandler);
-    /**
-     * @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
-     */
     class BanAction extends AbstractUserAction_1.default {
         init() {
             this.banHandler = new Ban_1.default([this.userId]);
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
-                const isBanned = Core.stringToBool(this.userData.dataset.banned);
+                const isBanned = Core.stringToBool(this.userDataElement.dataset.banned);
                 if (isBanned) {
                     this.banHandler.unban(() => {
-                        this.userData.dataset.banned = "false";
+                        this.userDataElement.dataset.banned = "false";
                         this.button.textContent = this.button.dataset.banMessage;
                         UiNotification.show();
                         EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
-                            userIds: [this.userId]
+                            userIds: [this.userId],
                         });
                     });
                 }
                 else {
                     this.banHandler.ban(() => {
-                        this.userData.dataset.banned = "true";
+                        this.userDataElement.dataset.banned = "true";
                         this.button.textContent = this.button.dataset.unbanMessage;
                         UiNotification.show();
                         EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
-                            userIds: [this.userId]
+                            userIds: [this.userId],
                         });
                     });
                 }
index f1b4ab105e11e4b59b085ecb6d3d187e80f31505..75560ea80e140437648b138020361bd786ef940b 100644 (file)
@@ -1,22 +1,22 @@
+/**
+ * @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) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.DeleteAction = void 0;
     AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
     Delete_1 = tslib_1.__importDefault(Delete_1);
-    /**
-     * @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
-     */
     class DeleteAction extends AbstractUserAction_1.default {
         init() {
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
-                let deleteHandler = new Delete_1.default([this.userId], () => {
-                    this.userData.remove();
+                const deleteHandler = new Delete_1.default([this.userId], () => {
+                    this.userDataElement.remove();
                 }, this.button.dataset.confirmMessage);
                 deleteHandler.delete();
             });
index efceca214d925d7c14fe113bd17a229b126cb4db..90b2051a5941f05f04eebd427d3c2126e11151a1 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * @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) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,51 +14,44 @@ define(["require", "exports", "tslib", "../../../../Ajax", "../../../../Core", "
     UiNotification = tslib_1.__importStar(UiNotification);
     AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
     EventHandler = tslib_1.__importStar(EventHandler);
-    /**
-     * @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
-     */
     class DisableAction extends AbstractUserAction_1.default {
         init() {
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
-                Ajax.api({
-                    _ajaxSetup: () => {
-                        const isEnabled = Core.stringToBool(this.userData.dataset.enabled);
-                        return {
-                            data: {
-                                actionName: (isEnabled ? "disable" : "enable"),
-                                className: "wcf\\data\\user\\UserAction",
-                                objectIDs: [this.userId],
-                            },
-                        };
-                    },
-                    _ajaxSuccess: (data) => {
-                        if (data.objectIDs.includes(this.userId)) {
-                            switch (data.actionName) {
-                                case "enable":
-                                    this.userData.dataset.enabled = "true";
-                                    this.button.textContent = this.button.dataset.disableMessage;
-                                    break;
-                                case "disable":
-                                    this.userData.dataset.enabled = "false";
-                                    this.button.textContent = this.button.dataset.enableMessage;
-                                    break;
-                                default:
-                                    throw new Error("Unreachable");
-                            }
-                        }
-                        UiNotification.show();
-                        EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
-                            userIds: [this.userId]
-                        });
-                    },
+                const isEnabled = Core.stringToBool(this.userDataElement.dataset.enabled);
+                Ajax.api(this, {
+                    actionName: isEnabled ? "disable" : "enable",
                 });
             });
         }
+        _ajaxSetup() {
+            return {
+                data: {
+                    className: "wcf\\data\\user\\UserAction",
+                    objectIDs: [this.userId],
+                },
+            };
+        }
+        _ajaxSuccess(data) {
+            if (data.objectIDs.includes(this.userId)) {
+                switch (data.actionName) {
+                    case "enable":
+                        this.userDataElement.dataset.enabled = "true";
+                        this.button.textContent = this.button.dataset.disableMessage;
+                        break;
+                    case "disable":
+                        this.userDataElement.dataset.enabled = "false";
+                        this.button.textContent = this.button.dataset.enableMessage;
+                        break;
+                    default:
+                        throw new Error("Unreachable");
+                }
+            }
+            UiNotification.show();
+            EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
+                userIds: [this.userId],
+            });
+        }
     }
     exports.DisableAction = DisableAction;
     exports.default = DisableAction;
index 7d0a0c519e1ee8384a9183b4ea5c917a7913db14..2bf06609b496cd450fdbb6ce9d72c72c35415fbe 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * @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", "../../../../../Language", "../../../../../Ajax", "../../../../../Ui/Dialog"], function (require, exports, tslib_1, Language, Ajax, Dialog_1) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,13 +12,6 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
     Language = tslib_1.__importStar(Language);
     Ajax = tslib_1.__importStar(Ajax);
     Dialog_1 = tslib_1.__importDefault(Dialog_1);
-    /**
-     * @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
-     */
     class BanHandler {
         constructor(userIDs) {
             this.userIDs = userIDs;
@@ -45,8 +45,8 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
                             className: "wcf\\data\\user\\UserAction",
                             objectIDs: this.userIDs,
                             parameters: {
-                                'banReason': reason,
-                                'banExpires': userBanExpires,
+                                banReason: reason,
+                                banExpires: userBanExpires,
                             },
                         },
                     };
@@ -58,7 +58,7 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
             return {
                 id: "userBanHandler",
                 options: {
-                    onShow: (content) => {
+                    onSetup: (content) => {
                         const submit = content.querySelector(".formSubmitButton");
                         const neverExpires = content.querySelector("#userBanNeverExpires");
                         const userBanExpiresSettings = content.querySelector("#userBanExpiresSettings");
@@ -84,14 +84,14 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
                             }
                         });
                     },
-                    title: Language.get('wcf.acp.user.ban.sure'),
+                    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>
+              <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>
+                <small>${Language.get("wcf.acp.user.banReason.description")}</small>
               </dd>
             </dl>
             <dl>
@@ -99,13 +99,13 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
               <dd>
                 <label for="userBanNeverExpires">
                   <input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
-                  ${Language.get('wcf.acp.user.ban.neverExpires')}
+                  ${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>
+                <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
               </dt>
               <dd>
                 <div class="inputAddon">
@@ -117,12 +117,12 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
                           data-ignore-timezone="true"
                   />
                 </div>
-                <small>${Language.get('wcf.acp.user.ban.expires.description')}</small>
+                <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>
+            <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get("wcf.global.button.submit")}</button>
           </div>`,
             };
         }
index f0ecfe250e7ac5277a8d15984ab642a08e4f9cb2..027fd388914aed5ad27f8c9082ace7e76cad6c45 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * @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", "../../../../../Language", "../../../../../Ui/Confirmation", "../../../../../Ajax"], function (require, exports, tslib_1, Language, UiConfirmation, Ajax) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,13 +12,6 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
     Language = tslib_1.__importStar(Language);
     UiConfirmation = tslib_1.__importStar(UiConfirmation);
     Ajax = tslib_1.__importStar(Ajax);
-    /**
-     * @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
-     */
     class Delete {
         constructor(userIDs, successCallback, deleteMessage) {
             this.userIDs = userIDs;
@@ -26,17 +26,13 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
         delete() {
             UiConfirmation.show({
                 confirm: () => {
-                    Ajax.api({
-                        _ajaxSetup: () => {
-                            return {
-                                data: {
-                                    actionName: "delete",
-                                    className: "wcf\\data\\user\\UserAction",
-                                    objectIDs: this.userIDs,
-                                },
-                            };
+                    Ajax.apiOnce({
+                        data: {
+                            actionName: "delete",
+                            className: "wcf\\data\\user\\UserAction",
+                            objectIDs: this.userIDs,
                         },
-                        _ajaxSuccess: this.successCallback,
+                        success: this.successCallback,
                     });
                 },
                 message: this.deleteMessage,
index b0ad9ab9cf911a84ee83f11ccc3de16ae10ab404..929e785b0ae057ea1c46f71b91bcf84335735e3b 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * @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", "../../../../../Language", "../../../../../Ui/Confirmation", "../../../Worker"], function (require, exports, tslib_1, Language, UiConfirmation, Worker_1) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,13 +12,6 @@ define(["require", "exports", "tslib", "../../../../../Language", "../../../../.
     Language = tslib_1.__importStar(Language);
     UiConfirmation = tslib_1.__importStar(UiConfirmation);
     Worker_1 = tslib_1.__importDefault(Worker_1);
-    /**
-     * @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
-     */
     class SendNewPassword {
         constructor(userIDs, successCallback) {
             this.userIDs = userIDs;
index 020425e13c7feda5d0316857705e6c96a3bb031b..b75cfdb6dfedc4167e2b79fbc68cfef614696d5d 100644 (file)
@@ -1,16 +1,16 @@
+/**
+ * @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) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.SendNewPasswordAction = void 0;
     AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
     SendNewPassword_1 = tslib_1.__importDefault(SendNewPassword_1);
-    /**
-     * @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
-     */
     class SendNewPasswordAction extends AbstractUserAction_1.default {
         init() {
             this.button.addEventListener("click", (event) => {
index 3243b6245bde5040e4aa0561ea19daff825867b9..76a344577833ce7148d6bb0cd5a9e8f18bf851b4 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * @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) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,48 +13,41 @@ define(["require", "exports", "tslib", "./AbstractUserAction", "../../../../Ajax
     Ajax = tslib_1.__importStar(Ajax);
     Core = tslib_1.__importStar(Core);
     UiNotification = tslib_1.__importStar(UiNotification);
-    /**
-     * @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
-     */
     class ToggleConfirmEmailAction extends AbstractUserAction_1.default {
         init() {
             this.button.addEventListener("click", (event) => {
                 event.preventDefault();
-                Ajax.api({
-                    _ajaxSetup: () => {
-                        const isEmailConfirmed = Core.stringToBool(this.userData.dataset.emailConfirmed);
-                        return {
-                            data: {
-                                actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
-                                className: "wcf\\data\\user\\UserAction",
-                                objectIDs: [this.userId],
-                            },
-                        };
-                    },
-                    _ajaxSuccess: (data) => {
-                        if (data.objectIDs.includes(this.userId)) {
-                            switch (data.actionName) {
-                                case "confirmEmail":
-                                    this.userData.dataset.emailConfirmed = "true";
-                                    this.button.textContent = this.button.dataset.unconfirmEmailMessage;
-                                    break;
-                                case "unconfirmEmail":
-                                    this.userData.dataset.emailConfirmed = "false";
-                                    this.button.textContent = this.button.dataset.confirmEmailMessage;
-                                    break;
-                                default:
-                                    throw new Error("Unreachable");
-                            }
-                        }
-                        UiNotification.show();
-                    },
+                const isEmailConfirmed = Core.stringToBool(this.userDataElement.dataset.emailConfirmed);
+                Ajax.api(this, {
+                    actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
                 });
             });
         }
+        _ajaxSetup() {
+            return {
+                data: {
+                    className: "wcf\\data\\user\\UserAction",
+                    objectIDs: [this.userId],
+                },
+            };
+        }
+        _ajaxSuccess(data) {
+            if (data.objectIDs.includes(this.userId)) {
+                switch (data.actionName) {
+                    case "confirmEmail":
+                        this.userDataElement.dataset.emailConfirmed = "true";
+                        this.button.textContent = this.button.dataset.unconfirmEmailMessage;
+                        break;
+                    case "unconfirmEmail":
+                        this.userDataElement.dataset.emailConfirmed = "false";
+                        this.button.textContent = this.button.dataset.confirmEmailMessage;
+                        break;
+                    default:
+                        throw new Error("Unreachable");
+                }
+            }
+            UiNotification.show();
+        }
     }
     exports.ToggleConfirmEmailAction = ToggleConfirmEmailAction;
     exports.default = ToggleConfirmEmailAction;
index eda27b916d3c6f5f14f84f510c5c61da94bd2aec..c61294a3231eaa868364edd96c7c0904fbceae82 100644 (file)
@@ -87,7 +87,6 @@ define(["require", "exports", "tslib", "./Content/Remove/Handler", "../../../Cor
             dropdownMenu.querySelectorAll(".jsLegacyItem").forEach((element) => element.remove());
             // inject buttons
             const items = [];
-            let deleteButton = null;
             Array.from(legacyButtonContainer.children).forEach((button) => {
                 const item = document.createElement("li");
                 item.className = "jsLegacyItem";