You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/12/12 11:04:44 UTC

[incubator-ponymail-foal] 03/04: Only show button if admin

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

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

commit ee1439670670b1e196c5fbd49a575f923d9587a5
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Dec 1 13:22:53 2020 +0100

    Only show button if admin
---
 webui/js/ponymail.js            | 6 ++++--
 webui/js/source/render-email.js | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index 6e9cd2e..010d2f8 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -2884,8 +2884,10 @@ async function render_email_chatty(state, json) {
     toolbar.inject(sourcebutton);
 
     // Admin button?
-    let adminbutton = new HTML('a', { href: '#', title: "Administrative control", class: 'btn toolbar_btn toolbar_button_admin'}, new HTML('span', { class: 'glyphicon glyphicon-cog'}, ' '));
-    toolbar.inject(adminbutton);
+    if (ponymail_preferences.login && ponymail_preferences.login.credentials && ponymail_preferences.login.credentials.admin) {
+        let adminbutton = new HTML('a', { href: '#', title: "Administrative control", class: 'btn toolbar_btn toolbar_button_admin'}, new HTML('span', { class: 'glyphicon glyphicon-cog'}, ' '));
+        toolbar.inject(adminbutton);
+    }
     
     text.inject(toolbar);
 }
diff --git a/webui/js/source/render-email.js b/webui/js/source/render-email.js
index fe8edd2..6aa63bf 100644
--- a/webui/js/source/render-email.js
+++ b/webui/js/source/render-email.js
@@ -172,8 +172,10 @@ async function render_email_chatty(state, json) {
     toolbar.inject(sourcebutton);
 
     // Admin button?
-    let adminbutton = new HTML('a', { href: '#', title: "Administrative control", class: 'btn toolbar_btn toolbar_button_admin'}, new HTML('span', { class: 'glyphicon glyphicon-cog'}, ' '));
-    toolbar.inject(adminbutton);
+    if (ponymail_preferences.login && ponymail_preferences.login.credentials && ponymail_preferences.login.credentials.admin) {
+        let adminbutton = new HTML('a', { href: '#', title: "Administrative control", class: 'btn toolbar_btn toolbar_button_admin'}, new HTML('span', { class: 'glyphicon glyphicon-cog'}, ' '));
+        toolbar.inject(adminbutton);
+    }
     
     text.inject(toolbar);
 }