From d91d32adfc66e3c74e4f12b679a40eb0962d9b92 Mon Sep 17 00:00:00 2001 From: Pranav Date: Sun, 29 Mar 2020 00:58:14 +0530 Subject: [PATCH] settings ui: Hide buttons to add/delete organization logo for nonadmins. Users are unable to modify organization's logos, but disabled buttons for the same are being shown to the user on the organization settings page. This commit removes those buttons. The file realm-logo-widget.hbs renders those buttons only if the user is an admin and realm_logo.js has been updated to allow operations (like click) on the buttons only to admins. --- static/js/realm_logo.js | 4 ++++ static/templates/settings/realm-logo-widget.hbs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/static/js/realm_logo.js b/static/js/realm_logo.js index 4bede94af3..b50335a3ff 100644 --- a/static/js/realm_logo.js +++ b/static/js/realm_logo.js @@ -13,6 +13,10 @@ exports.build_realm_logo_widget = function (upload_function, is_night) { return file_input_elem.expectOne(); }; + if (!page_params.is_admin) { + return; + } + if (page_params.realm_logo_source === 'D') { delete_button_elem.hide(); } else { diff --git a/static/templates/settings/realm-logo-widget.hbs b/static/templates/settings/realm-logo-widget.hbs index 686725e679..95f721b4a1 100644 --- a/static/templates/settings/realm-logo-widget.hbs +++ b/static/templates/settings/realm-logo-widget.hbs @@ -4,6 +4,7 @@ + {{#if is_admin}}
{{#if plan_includes_wide_organization_logo}} @@ -16,4 +17,5 @@ {{/if}}
+ {{/if}}