user settings: Hide disabled name change info icon for admins.

This icon should only show when the user is not an admin and either the
realm or server settings have disabled name changes. Previously the icon
always showed for admin users.
This commit is contained in:
Cynthia Lin 2019-07-14 09:41:50 +00:00 committed by Tim Abbott
parent a73155c78f
commit 50cab76c59
2 changed files with 6 additions and 1 deletions

View File

@ -871,21 +871,25 @@ run_test('misc', () => {
page_params.server_name_changes_disabled = false;
settings_account.update_name_change_display();
assert.equal($('#full_name').attr('disabled'), false);
assert.equal($('.change_name_tooltip').is(':visible'), false);
page_params.realm_name_changes_disabled = true;
page_params.server_name_changes_disabled = false;
settings_account.update_name_change_display();
assert.equal($('#full_name').attr('disabled'), 'disabled');
assert($('.change_name_tooltip').is(':visible'));
page_params.realm_name_changes_disabled = true;
page_params.server_name_changes_disabled = true;
settings_account.update_name_change_display();
assert.equal($('#full_name').attr('disabled'), 'disabled');
assert($('.change_name_tooltip').is(':visible'));
page_params.realm_name_changes_disabled = false;
page_params.server_name_changes_disabled = true;
settings_account.update_name_change_display();
assert.equal($('#full_name').attr('disabled'), 'disabled');
assert($('.change_name_tooltip').is(':visible'));
page_params.realm_email_changes_disabled = false;
settings_account.update_email_change_display();
@ -923,6 +927,7 @@ run_test('misc', () => {
page_params.is_admin = true;
settings_account.update_name_change_display();
assert.equal($('#full_name').attr('disabled'), false);
assert.equal($('.change_name_tooltip').is(':visible'), false);
settings_account.update_email_change_display();
assert.equal($("#change_email .button").attr('disabled'), false);

View File

@ -58,7 +58,7 @@
</button>
</a>
<i class="fa fa-question-circle change_name_tooltip settings-info-icon" data-toggle="tooltip"
{{#unless page_params.is_admin}}{{#if page_params.realm_name_changes_disabled}}{{else}}{{#unless page_params.server_name_changes_disabled}}style="display:none"{{/unless}}{{/if}}{{/unless}}
{{#if (or page_params.is_admin (not (or page_params.realm_name_changes_disabled page_params.server_name_changes_disabled)))}}style="display:none"{{/if}}
title="{{t 'Name changes are disabled in this organization. Contact an administrator to change your name.' }}"/>
</div>
<div id="change_full_name_modal" class="modal modal-bg hide fade" tabindex="-1" role="dialog"