settings: Fix live update of email change button.

This commit fixes a bug of not enabling/disabling
the email-change button when email_changes_disabled
setting is changed. Bug was because of using wrong
selector.
This commit is contained in:
sahil839 2021-06-24 19:25:14 +05:30 committed by Tim Abbott
parent c32a036449
commit e0fc6df2b4
2 changed files with 5 additions and 5 deletions

View File

@ -857,11 +857,11 @@ test("misc", ({override}) => {
page_params.realm_email_changes_disabled = false;
settings_account.update_email_change_display();
assert.ok(!$("#change_email .button").prop("disabled"));
assert.ok(!$("#change_email").prop("disabled"));
page_params.realm_email_changes_disabled = true;
settings_account.update_email_change_display();
assert.ok($("#change_email .button").prop("disabled"));
assert.ok($("#change_email").prop("disabled"));
page_params.realm_avatar_changes_disabled = false;
page_params.server_avatar_changes_disabled = false;
@ -891,7 +891,7 @@ test("misc", ({override}) => {
assert.equal($(".change_name_tooltip").is(":visible"), false);
settings_account.update_email_change_display();
assert.ok(!$("#change_email .button").prop("disabled"));
assert.ok(!$("#change_email").prop("disabled"));
override(stream_settings_data, "get_streams_for_settings_page", () => [
{name: "some_stream", stream_id: 75},

View File

@ -62,10 +62,10 @@ export function update_name_change_display() {
export function update_email_change_display() {
if (page_params.realm_email_changes_disabled && !page_params.is_admin) {
$("#change_email .button").prop("disabled", true);
$("#change_email").prop("disabled", true);
$(".change_email_tooltip").show();
} else {
$("#change_email .button").prop("disabled", false);
$("#change_email").prop("disabled", false);
$(".change_email_tooltip").hide();
}
}