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 e7a03d994c4995a4bdd6bac01567a1d0bb682f10
Author: Sebb <[email protected]>
AuthorDate: Tue Nov 23 17:01:46 2021 +0000

    Clear wordCloud if no data
    
    This fixes #152
---
 webui/js/source/sidebar-stats.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/webui/js/source/sidebar-stats.js b/webui/js/source/sidebar-stats.js
index 7fe38b7..d323bca 100644
--- a/webui/js/source/sidebar-stats.js
+++ b/webui/js/source/sidebar-stats.js
@@ -35,8 +35,12 @@ async function sidebar_stats(json) {
         }
     }
 
+    let wc = document.getElementById('sidebar_wordcloud');
     if (!json.emails || isHash(json.emails) || json.emails.length == 0) {
         obj.innerText = "No emails found...";
+        if (wc) {
+            wc.innerHTML = "";
+        }
         return;
     }
 
@@ -69,7 +73,6 @@ async function sidebar_stats(json) {
     }
 
     // Word cloud, if applicable
-    let wc = document.getElementById('sidebar_wordcloud');
     if (wc && json.cloud) {
         wc.innerHTML = "";
         wc.inject(new HTML('h5', {}, "Popular topics:"));

Reply via email to