digest: Fix visibility toggling of digest notifications checkbox.

This commit is contained in:
Puneeth Chaganti 2019-05-10 12:15:46 +05:30 committed by Tim Abbott
parent 28df5f83dd
commit 4383c819cf
3 changed files with 10 additions and 12 deletions

View File

@ -37,6 +37,14 @@ function change_notification_setting(setting, setting_data, status_element) {
settings_ui.do_settings_change(channel.patch, '/json/settings/notifications', data, status_element);
}
exports.set_enable_digest_emails_visibility = function () {
if (page_params.realm_digest_emails_enabled) {
$('#enable_digest_emails_label').parent().show();
} else {
$('#enable_digest_emails_label').parent().hide();
}
};
exports.set_up = function () {
_.each(pm_mention_notification_settings, function (setting) {
$("#" + setting).change(function () {
@ -85,6 +93,7 @@ exports.set_up = function () {
notification_sound_dropdown.parent().addClass("control-label-disabled");
}
});
exports.set_enable_digest_emails_visibility();
};
exports.update_page = function () {

View File

@ -274,14 +274,6 @@ function set_message_content_in_email_notifications_visiblity() {
}
}
function set_enable_digest_emails_visibility() {
if (page_params.realm_digest_emails_enabled) {
$('#enable_digest_emails_label').parent().show();
} else {
$('#enable_digest_emails_label').parent().hide();
}
}
function set_digest_emails_weekday_visibility() {
if (page_params.realm_digest_emails_enabled) {
$('#id_realm_digest_weekday').parent().show();
@ -437,7 +429,7 @@ function update_dependent_subsettings(property_name) {
} else if (property_name === 'realm_message_content_allowed_in_email_notifications') {
set_message_content_in_email_notifications_visiblity();
} else if (property_name === 'realm_digest_emails_enabled') {
set_enable_digest_emails_visibility();
settings_notifications.set_enable_digest_emails_visibility();
set_digest_emails_weekday_visibility();
}
}
@ -601,7 +593,6 @@ exports.build_page = function () {
set_org_join_restrictions_dropdown();
set_user_invite_restriction_dropdown();
set_message_content_in_email_notifications_visiblity();
set_enable_digest_emails_visibility();
set_digest_emails_weekday_visibility();
function check_property_changed(elem) {

View File

@ -103,12 +103,10 @@
<h5>{{t "Email" }}</h5>
{{#if page_params.realm_digest_emails_enabled}}
{{partial "settings_checkbox"
"setting_name" "enable_digest_emails"
"is_checked" page_params.enable_digest_emails
"label" settings_label.enable_digest_emails}}
{{/if}}
{{partial "settings_checkbox"
"setting_name" "enable_login_emails"