From ac2f1cea9c4c10edba764859820271ef584f3a55 Mon Sep 17 00:00:00 2001 From: Pragati Agrawal Date: Thu, 18 Jul 2019 18:51:09 +0530 Subject: [PATCH] settings_org: Enhance `show_emails` for admins only case too. This adds on the `is_admin` clause to show_emails. --- frontend_tests/node_tests/popovers.js | 2 ++ static/js/settings_org.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index 3cf06e0213..b63fa91b65 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -21,6 +21,8 @@ popovers.hide_user_profile = noop; set_global('current_msg_list', {}); set_global('page_params', { + is_admin: false, + realm_email_address_visibility: 3, custom_profile_fields: [], }); set_global('rows', {}); diff --git a/static/js/settings_org.js b/static/js/settings_org.js index afa142101b..77c7874324 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -58,8 +58,14 @@ exports.email_address_visibility_values = { exports.show_email = function () { // TODO: Extend this when we add support for admins_and_members above. - return page_params.realm_email_address_visibility === - exports.email_address_visibility_values.everyone.code; + if (page_params.realm_email_address_visibility === + exports.email_address_visibility_values.everyone.code) { + return true; + } + if (page_params.realm_email_address_visibility === + exports.email_address_visibility_values.admins_only.code) { + return page_params.is_admin; + } }; exports.get_realm_time_limits_in_minutes = function (property) {