From 235b247a0d7d1f0f3c4e19acc20e783446acdf34 Mon Sep 17 00:00:00 2001 From: joshuaruesweg Date: Mon, 28 Jun 2021 17:13:57 +0200 Subject: [PATCH] Fix codestyle --- .../Acp/Ui/User/Action/AbstractUserAction.ts | 18 +- .../Core/Acp/Ui/User/Action/BanAction.ts | 28 +-- .../Core/Acp/Ui/User/Action/DeleteAction.ts | 20 +- .../Core/Acp/Ui/User/Action/DisableAction.ts | 85 ++++---- .../Core/Acp/Ui/User/Action/Handler/Ban.ts | 185 +++++++++--------- .../Core/Acp/Ui/User/Action/Handler/Delete.ts | 38 ++-- .../Ui/User/Action/Handler/SendNewPassword.ts | 15 +- .../Ui/User/Action/SendNewPasswordAction.ts | 9 +- .../User/Action/ToggleConfirmEmailAction.ts | 85 ++++---- ts/WoltLabSuite/Core/Acp/Ui/User/Editor.ts | 3 +- .../install/files/acp/templates/userAdd.tpl | 65 ++++-- .../Acp/Ui/User/Action/AbstractUserAction.js | 9 +- .../Core/Acp/Ui/User/Action/BanAction.js | 24 +-- .../Core/Acp/Ui/User/Action/DeleteAction.js | 18 +- .../Core/Acp/Ui/User/Action/DisableAction.js | 76 +++---- .../Core/Acp/Ui/User/Action/Handler/Ban.js | 34 ++-- .../Core/Acp/Ui/User/Action/Handler/Delete.js | 30 ++- .../Ui/User/Action/Handler/SendNewPassword.js | 14 +- .../Ui/User/Action/SendNewPasswordAction.js | 14 +- .../User/Action/ToggleConfirmEmailAction.js | 70 +++---- .../WoltLabSuite/Core/Acp/Ui/User/Editor.js | 1 - 21 files changed, 442 insertions(+), 399 deletions(-) diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts index 4537cda044..75a3ace37f 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/AbstractUserAction.ts @@ -1,17 +1,25 @@ +/** + * @author Joshua Ruesweg + * @copyright 2001-2021 WoltLab GmbH + * @license GNU Lesser General Public License + * @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; diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/BanAction.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/BanAction.ts index ab70349d75..6085667bac 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/BanAction.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/BanAction.ts @@ -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], }); }); } diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DeleteAction.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DeleteAction.ts index 559527d5dd..c2d4dfeeaf 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DeleteAction.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DeleteAction.ts @@ -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(); }); } diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.ts index f132404333..8fddd1c0f3 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.ts @@ -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 { + 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], }); } } diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban.ts index b5654d755d..06c288ae24 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban.ts @@ -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 { - 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 { + 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: `
+ 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: `
-
+
- ${Language.get('wcf.acp.user.banReason.description')} + ${Language.get("wcf.acp.user.banReason.description")}
@@ -116,13 +111,13 @@ export class BanHandler {
- +
`, - }; - } + }; + } } -export default BanHandler; \ No newline at end of file +export default BanHandler; diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Delete.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Delete.ts index 3a6a58abd1..5edebe6722 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Delete.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Delete.ts @@ -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, diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/SendNewPassword.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/SendNewPassword.ts index 4dc42b2901..0578c44e9d 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/SendNewPassword.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/SendNewPassword.ts @@ -1,3 +1,11 @@ +/** + * @author Joshua Ruesweg + * @copyright 2001-2021 WoltLab GmbH + * @license GNU Lesser General Public License + * @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 - * @module WoltLabSuite/Core/Acp/Ui/User/Action/Handler - * @since 5.5 - */ export class SendNewPassword { private userIDs: number[]; private successCallback: CallbackSuccess | null; diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction.ts index 9bfde2d239..9e2024a279 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction.ts @@ -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(); diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.ts index 1b7851a5f1..ec24798587 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.ts @@ -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 { + 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; diff --git a/ts/WoltLabSuite/Core/Acp/Ui/User/Editor.ts b/ts/WoltLabSuite/Core/Acp/Ui/User/Editor.ts index 406d795eec..9b8db74b35 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/User/Editor.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/User/Editor.ts @@ -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; diff --git a/wcfsetup/install/files/acp/templates/userAdd.tpl b/wcfsetup/install/files/acp/templates/userAdd.tpl index 1da5e151ef..5b6e39c190 100644 --- a/wcfsetup/install/files/acp/templates/userAdd.tpl +++ b/wcfsetup/install/files/acp/templates/userAdd.tpl @@ -10,38 +10,77 @@
    {if $action === 'edit'}
  • -