This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 999820cc7c8e8abda7c4660325ce54ddfdacf9cc
Author: Sebb <[email protected]>
AuthorDate: Thu Dec 16 19:25:51 2021 +0000

    Simplify using for of loop
---
 webui/js/source/mgmt.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/webui/js/source/mgmt.js b/webui/js/source/mgmt.js
index 5bc3a03..59545a2 100644
--- a/webui/js/source/mgmt.js
+++ b/webui/js/source/mgmt.js
@@ -247,8 +247,7 @@ function admin_email_preview(stats, json) {
             class: 'email_key'
         }, "Attachment(s): ");
         let alinks = [];
-        for (let n = 0; n < json.attachments.length; n++) {
-            let attachment = json.attachments[n];
+        for (let attachment of json.attachments) {
             let link = 
`${G_apiURL}api/email.lua?attachment=true&id=${json.mid}&file=${attachment.hash}`;
             let a = new HTML('a', {
                 href: link,
@@ -347,8 +346,8 @@ function admin_audit_view(state, json) {
                 class: "auditlog_entries"
             });
             let trh = new HTML('tr');
-            for (let i = 0; i < headers.length; i++) {
-                let th = new HTML('th', {}, headers[i] + ":");
+            for (let header of headers) {
+                let th = new HTML('th', {}, header + ":");
                 trh.inject(th);
             }
             table.inject(trh)
@@ -358,13 +357,12 @@ function admin_audit_view(state, json) {
             }, "Load more entries");
             div.inject(btn);
         }
-        for (let i = 0; i < json.entries.length; i++) {
-            let entry = json.entries[i];
+        for (let entry of json.entries) {
             let tr = new HTML('tr', {
                 class: "auditlog_entry"
             });
-            for (let i = 0; i < headers.length; i++) {
-                let key = headers[i].toLowerCase();
+            for (let header of headers) {
+                let key = header.toLowerCase();
                 let value = entry[key];
                 if (key == 'target') {
                     value = new HTML('a', {

Reply via email to