Fix codestyle issues
authorJoshua Rüsweg <ruesweg@woltlab.com>
Tue, 6 Jul 2021 11:58:09 +0000 (13:58 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Fri, 6 Aug 2021 12:07:49 +0000 (14:07 +0200)
Co-authored-by: Matthias Schmidt <gravatronics@live.com>
ts/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.ts
ts/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.ts
wcfsetup/install/files/acp/templates/userAdd.tpl
wcfsetup/install/files/acp/templates/userList.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Dialog/Ban.js
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction.js

index 8fddd1c0f3a374f9d0b6490b3ecd0b09e3959307..fe842dd31d9cb6f0a462f1527f2b7d2d1a00a472 100644 (file)
@@ -35,22 +35,24 @@ export class DisableAction extends AbstractUserAction implements AjaxCallbackObj
   }
 
   _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.userDataElement.dataset.enabled = "false";
-          this.button.textContent = this.button.dataset.enableMessage!;
-          break;
-
-        default:
-          throw new Error("Unreachable");
+    data.objectIDs.forEach((objectId) => {
+      if (~~objectId == 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();
 
index 4430eadee5e12d012c41a7623243e784a12807b3..7db3a45cd94e65466b616ddb9c2f2f731c4a8f19 100644 (file)
@@ -99,46 +99,47 @@ export class BanDialog {
         },
         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>`,
+      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>`,
     };
   }
 }
index ec24798587f65eed96bbc82811430ffcd816e658..584eb9a86fa1b0cf88214cbcecfa3afe4f32872f 100644 (file)
@@ -34,22 +34,24 @@ export class ToggleConfirmEmailAction extends AbstractUserAction {
   }
 
   _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");
+    data.objectIDs.forEach((objectId) => {
+      if (~~objectId == 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();
   }
index 5b6e39c190a44a4fee5bb9350980bc9cc85ab7e6..f42bebb01ee131b0db20d19e519bfa0b3e6c268a 100644 (file)
                                                        {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}"{*
+                                                                               <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>
@@ -74,7 +73,7 @@
                                                        {/if}
 
                                                        {if $__wcf->session->getPermission('admin.user.canExportGdprData')}
-                                                               <li
+                                                               <li>
                                                                        <a {*
                                                                                *}href="{link controller='UserExportGdpr' id=$user->userID}{/link}"{*
                                                                                *}>
                                        </div>
                                </li>
                                <script data-relocate="true">
-                                       require(['Language',
-                                                        'WoltLabSuite/Core/Acp/Ui/User/Editor',
-                                                        'WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler',
-                                                        'WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction',
-                                                        'WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction',
-                                                        'WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction',
-                                                        'WoltLabSuite/Core/Controller/Clipboard',
-                                               ],
-                                               function (
-                                                        Language,
-                                                        AcpUiUserList,
-                                                        AcpUserContentRemoveHandler,
-                                                        DisableAction,
-                                                        SendNewPasswordAction,
-                                                        ToggleConfirmEmailAction,
-                                                        Clipboard
-                                               ) {
+                                       require([
+                                               'WoltLabSuite/Core/Language',
+                                               'WoltLabSuite/Core/Acp/Ui/User/Editor',
+                                               'WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler',
+                                               'WoltLabSuite/Core/Acp/Ui/User/Action/DisableAction',
+                                               'WoltLabSuite/Core/Acp/Ui/User/Action/SendNewPasswordAction',
+                                               'WoltLabSuite/Core/Acp/Ui/User/Action/ToggleConfirmEmailAction',
+                                               'WoltLabSuite/Core/Controller/Clipboard',
+                                       ], (
+                                               Language,
+                                               AcpUiUserList,
+                                               AcpUserContentRemoveHandler,
+                                               DisableAction,
+                                               SendNewPasswordAction,
+                                               ToggleConfirmEmailAction,
+                                               Clipboard
+                                       ) => {
                                                        Language.addObject({
                                                                'wcf.acp.user.sendNewPassword.workerTitle': '{jslang}wcf.acp.user.sendNewPassword.workerTitle{/jslang}',
                                                                'wcf.acp.user.action.sendNewPassword.confirmMessage': '{jslang}wcf.acp.user.action.sendNewPassword.confirmMessage{/jslang}',
index fcb9179880cd7afeb6b276a16742a105b6c147b7..263d6fd1ff55eabf6b28a9b53693c70ebd61b310 100644 (file)
                        WCF.ACP.User.SendNewPasswordHandler.init();
                {/if}
 
-               require(['Language', 'WoltLabSuite/Core/Acp/Ui/User/Editor', 'WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Clipboard'], function (Language, AcpUiUserList, AcpUserContentRemoveClipboard) {
+               require(['Language', 'WoltLabSuite/Core/Acp/Ui/User/Editor', 'WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Clipboard'], function (Language, AcpUiUserList, { AcpUserContentRemoveClipboard }) {
                        Language.addObject({
                                'wcf.acp.user.action.sendNewPassword.confirmMessage': '{jslang}wcf.acp.user.action.sendNewPassword.confirmMessage{/jslang}',
                        });
 
                        new AcpUiUserList();
 
-                       new AcpUserContentRemoveClipboard.default();
+                       new AcpUserContentRemoveClipboard();
                });
 
                {event name='javascriptInit'}
index 90b2051a5941f05f04eebd427d3c2126e11151a1..19a37bee2244a7fa232127ac8a60074cbd41292a 100644 (file)
@@ -33,20 +33,22 @@ define(["require", "exports", "tslib", "../../../../Ajax", "../../../../Core", "
             };
         }
         _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");
+            data.objectIDs.forEach((objectId) => {
+                if (~~objectId == 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],
index 921ba376d8d836c0250c68991999b61abc239024..aec65ef65634237c408034275b40482ea49f31fb 100644 (file)
@@ -80,44 +80,45 @@ define(["require", "exports", "tslib", "../../../../../../Ui/Dialog", "../../../
                     },
                     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>`,
+                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>`,
             };
         }
     }
index 76a344577833ce7148d6bb0cd5a9e8f18bf851b4..3ca6146c9ca00c6ed55b12ab3d89fcaabab44002 100644 (file)
@@ -32,20 +32,22 @@ define(["require", "exports", "tslib", "./AbstractUserAction", "../../../../Ajax
             };
         }
         _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");
+            data.objectIDs.forEach((objectId) => {
+                if (~~objectId == 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();
         }
     }