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) {