From e0fc6df2b42cad196ff0dbca1ae4f98eafb1ee55 Mon Sep 17 00:00:00 2001 From: sahil839 Date: Thu, 24 Jun 2021 19:25:14 +0530 Subject: [PATCH] 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. --- frontend_tests/node_tests/settings_org.js | 6 +++--- static/js/settings_account.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index 817fa3bffa..9c7f010efd 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -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}, diff --git a/static/js/settings_account.js b/static/js/settings_account.js index 89f9ede3c5..3e06b190d7 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -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(); } }