You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/09/26 13:40:19 UTC

[incubator-ponymail-foal] branch master updated: JS may pick dev@ even if it does not exist

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


The following commit(s) were added to refs/heads/master by this push:
     new 0a694f6  JS may pick dev@ even if it does not exist
0a694f6 is described below

commit 0a694f6cbaaea28b5c6fb45990a286fd814d12be
Author: Sebb <se...@apache.org>
AuthorDate: Sun Sep 26 14:40:11 2021 +0100

    JS may pick dev@ even if it does not exist
    
    This fixes #99
---
 webui/js/ponymail.js          | 19 +------------------
 webui/js/source/list-index.js | 19 +------------------
 2 files changed, 2 insertions(+), 36 deletions(-)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 178409b..219fb05 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -1980,28 +1980,11 @@ function list_index(state, json) {
 }
 
 
-let preferred_lists = ['dev', 'users'];
-let preferred_no_lists = ['security'];
-
 function is_letter(domain, letter) {
     if (letter == '#' && domain.match(/^([^a-zA-Z]+)/)) return true
     else return domain.toLowerCase().startsWith(letter.toLowerCase());
 }
 
-function best_list(entries) {
-    let x = 0;
-    let pick = 'dev';
-    for (var key in entries) {
-        if (preferred_lists.has(key)) return key;
-        if (preferred_no_lists.has(key) && Object.keys(entries).length > 1) continue;
-        if (entries[key] > x) {
-            x = entries[key];
-            pick = key;
-        }
-    }
-    return pick;
-}
-
 function list_index_onepage(state, json) {
     let obj = document.getElementById('list_index_child');
     obj.style.padding = '8px';
@@ -2017,7 +2000,7 @@ function list_index_onepage(state, json) {
             obj.inject(lhtml);
         }
         let a = new HTML('a', {
-            href: 'list.html?%s@%s'.format(best_list(json.lists[domain]), domain)
+            href: 'list.html?%s'.format(domain)
         }, domain);
         obj.inject(['- ', a]);
         obj.inject(new HTML('br'));
diff --git a/webui/js/source/list-index.js b/webui/js/source/list-index.js
index c37097b..02a1af3 100644
--- a/webui/js/source/list-index.js
+++ b/webui/js/source/list-index.js
@@ -63,28 +63,11 @@ function list_index(state, json) {
 }
 
 
-let preferred_lists = ['dev', 'users'];
-let preferred_no_lists = ['security'];
-
 function is_letter(domain, letter) {
     if (letter == '#' && domain.match(/^([^a-zA-Z]+)/)) return true
     else return domain.toLowerCase().startsWith(letter.toLowerCase());
 }
 
-function best_list(entries) {
-    let x = 0;
-    let pick = 'dev';
-    for (var key in entries) {
-        if (preferred_lists.has(key)) return key;
-        if (preferred_no_lists.has(key) && Object.keys(entries).length > 1) continue;
-        if (entries[key] > x) {
-            x = entries[key];
-            pick = key;
-        }
-    }
-    return pick;
-}
-
 function list_index_onepage(state, json) {
     let obj = document.getElementById('list_index_child');
     obj.style.padding = '8px';
@@ -100,7 +83,7 @@ function list_index_onepage(state, json) {
             obj.inject(lhtml);
         }
         let a = new HTML('a', {
-            href: 'list.html?%s@%s'.format(best_list(json.lists[domain]), domain)
+            href: 'list.html?%s'.format(domain)
         }, domain);
         obj.inject(['- ', a]);
         obj.inject(new HTML('br'));