settings: Remove realm-level default of enable_login_emails setting.

This commit does not remove the 'enable_login_emails' field from
RealmUserDefault table but it is just not used and cannot be
changed from UI or API similar to 'enable_marketing_emails' setting.
This commit is contained in:
Sahil Batra 2021-09-28 13:33:43 +05:30 committed by Tim Abbott
parent 8b638648dc
commit d1732fb9da
6 changed files with 10 additions and 19 deletions

View File

@ -62,12 +62,10 @@ function get_realm_level_notification_settings(options) {
realm_user_settings_defaults,
);
// We remove enable_marketing_emails setting from all_notification_settings, since there is no
// realm-level default of this setting.
all_notifications_settings.settings.other_email_settings = [
"enable_digest_emails",
"enable_login_emails",
];
// We remove enable_marketing_emails and enable_login_emails
// setting from all_notification_settings, since there are no
// realm-level defaults for these setting.
all_notifications_settings.settings.other_email_settings = ["enable_digest_emails"];
options.general_settings = all_notifications_settings.general_settings;
options.notification_settings = all_notifications_settings.settings;

View File

@ -406,9 +406,6 @@ export const realm_user_settings_defaults_labels = {
defaultMessage: "Send mobile notifications even if user is online (useful for testing)",
}),
enable_digest_emails: $t({defaultMessage: "Send digest emails when user is away"}),
enable_login_emails: $t({
defaultMessage: "Send email notifications for new logins to the account",
}),
realm_presence_enabled: $t({defaultMessage: "Display availability to other users when online"}),
realm_enter_sends: $t({defaultMessage: "Enter sends when composing a message"}),

View File

@ -29,7 +29,9 @@ def copy_default_settings(
#
# Note that this function will do at least one save() on target_profile.
for settings_name in UserBaseSettings.property_types:
if settings_name == "default_language" and isinstance(settings_source, RealmUserDefault):
if settings_name in ["default_language", "enable_login_emails"] and isinstance(
settings_source, RealmUserDefault
):
continue
value = getattr(settings_source, settings_name)
setattr(target_profile, settings_name, value)

View File

@ -7767,13 +7767,6 @@ paths:
schema:
type: boolean
example: true
- name: enable_login_emails
in: query
description: |
Enable email notifications for new logins to account.
schema:
type: boolean
example: true
- name: message_content_in_email_notifications
in: query
description: |

View File

@ -913,7 +913,7 @@ class RealmAPITest(ZulipTestCase):
# duplicate code. default_language is currently present in Realm table also and thus
# is updated using '/realm' endpoint, but this will be removed in future and the
# settings in RealmUserDefault table will be used.
if prop in ["default_language", "enable_marketing_emails"]:
if prop in ["default_language", "enable_login_emails", "enable_marketing_emails"]:
continue
self.do_test_realm_default_setting_update_api(prop)

View File

@ -326,7 +326,8 @@ def update_realm_user_settings_defaults(
),
enable_online_push_notifications: Optional[bool] = REQ(json_validator=check_bool, default=None),
enable_digest_emails: Optional[bool] = REQ(json_validator=check_bool, default=None),
enable_login_emails: Optional[bool] = REQ(json_validator=check_bool, default=None),
# enable_login_emails is not included here, because we don't want
# security-related settings to be controlled by organization administrators.
# enable_marketing_emails is not included here, since we don't at
# present allow organizations to customize this. (The user's selection
# in the signup form takes precedence over RealmUserDefault).