From 37546872f9c4336787b9917ca9841a9743988c5b Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Wed, 17 Apr 2024 10:37:41 +0200 Subject: [PATCH] js/mailhops_details.js: move auth data out of routes calculation. Auth data needs only be processed once and is independent from the actual route data. This has the added benefit that auth data, which is entirely local, is shown even if the API returned an error. --- js/mailhops_details.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/js/mailhops_details.js b/js/mailhops_details.js index 845b496..07313a4 100644 --- a/js/mailhops_details.js +++ b/js/mailhops_details.js @@ -129,25 +129,26 @@ function updateContent(msg, noauth) { asn = '
ASN Org: ' + MailHopsUtils.htmlEncode(route[i].asn.autonomous_system_organization); asn += ' (' + route[i].asn.autonomous_system_number + ')' } - - var auth = ''; - if (!noauth && msg.message.auth.length) { - for (var a = 0; a < msg.message.auth.length; a++){ - if (msg.message.auth[a].icon) { - auth += ''; + + // append child + items.push('
' + header + weather +'
'+ description + asn + '
'); + } + + var auth = ''; + if (!noauth && msg.message.auth.length) { + for (var a = 0; a < msg.message.auth.length; a++){ + if (msg.message.auth[a].icon) { + auth += ''; + } + else if (msg.message.auth[a].link) { + if (-1 !== msg.message.auth[a].link.indexOf(',')) { + auth += '' + msg.message.auth[a].type + ''; } - else if (msg.message.auth[a].link) { - if (-1 !== msg.message.auth[a].link.indexOf(',')) { - auth += '' + msg.message.auth[a].type + ''; - } - else { - auth += '' + msg.message.auth[a].type + ''; - } + else { + auth += '' + msg.message.auth[a].type + ''; } } } - // append child - items.push('
' + header + weather +'
'+ description + asn + '
'); } // header