home: Get enable_stream_desktop_notifications from register_ret.

This commit is contained in:
Tim Abbott
2017-04-28 22:01:46 -07:00
parent 2a8a101fe2
commit 2a16cc1d24
8 changed files with 9 additions and 11 deletions

View File

@@ -49,7 +49,7 @@ i18n.init({
avatar_url: "http://example.com",
left_side_userlist: false,
twenty_four_hour_time: false,
stream_desktop_notifications_enabled: false,
enable_stream_desktop_notifications: false,
enable_stream_sounds: false,
desktop_notifications_enabled: false,
enable_sounds: false,

View File

@@ -779,7 +779,7 @@ function render(template_name, args) {
(function settings_tab() {
var page_param_checkbox_options = {
stream_desktop_notifications_enabled: true,
enable_stream_desktop_notifications: true,
enable_stream_sounds: true, desktop_notifications_enabled: true,
enable_sounds: true, enable_offline_email_notifications: true,
enable_offline_push_notifications: true, enable_online_push_notifications: true,

View File

@@ -636,7 +636,7 @@ exports.handle_global_notification_updates = function (notification_name, settin
// for a given message. These settings do not affect whether or not a
// particular stream should receive notifications.
if (notification_name === "enable_stream_desktop_notifications") {
page_params.stream_desktop_notifications_enabled = setting;
page_params.enable_stream_desktop_notifications = setting;
} else if (notification_name === "enable_stream_sounds") {
page_params.enable_stream_sounds = setting;
} else if (notification_name === "enable_desktop_notifications") {

View File

@@ -16,7 +16,7 @@ exports.set_up = function () {
// Stream notification settings.
if (result.enable_stream_desktop_notifications !== undefined) {
page_params.stream_desktop_notifications_enabled =
page_params.enable_stream_desktop_notifications =
result.enable_stream_desktop_notifications;
}
if (result.enable_stream_sounds !== undefined) {
@@ -142,7 +142,7 @@ exports.set_up = function () {
};
function _update_page() {
$("#enable_stream_desktop_notifications").prop('checked', page_params.stream_desktop_notifications_enabled);
$("#enable_stream_desktop_notifications").prop('checked', page_params.enable_stream_desktop_notifications);
$("#enable_stream_sounds").prop('checked', page_params.enable_stream_sounds);
$("#enable_desktop_notifications").prop('checked', page_params.desktop_notifications_enabled);
$("#enable_sounds").prop('checked', page_params.enable_sounds);

View File

@@ -278,7 +278,7 @@ exports.create_sub_from_server_data = function (stream_name, attrs) {
newly_subscribed: false,
in_home_view: true,
invite_only: false,
desktop_notifications: page_params.stream_desktop_notifications_enabled,
desktop_notifications: page_params.enable_stream_desktop_notifications,
audible_notifications: page_params.enable_stream_sounds,
description: '',
});

View File

@@ -17,7 +17,7 @@
<label class="checkbox">
<input type="checkbox" class="inline-block" name="enable_stream_desktop_notifications"
id="enable_stream_desktop_notifications"
{{#if page_params.stream_desktop_notifications_enabled}}
{{#if page_params.enable_stream_desktop_notifications}}
checked="checked"
{{/if}} />
<span></span>

View File

@@ -63,6 +63,7 @@ class HomeTest(ZulipTestCase):
"enable_offline_push_notifications",
"enable_online_push_notifications",
"enable_sounds",
"enable_stream_desktop_notifications",
"enable_stream_sounds",
"enter_sends",
"first_in_realm",
@@ -133,7 +134,6 @@ class HomeTest(ZulipTestCase):
"server_inline_url_embed_preview",
"server_uri",
"share_the_love",
"stream_desktop_notifications_enabled",
"subscriptions",
"test_suite",
"timezone",

View File

@@ -222,9 +222,6 @@ def home_real(request):
avatar_url_medium = avatar_url(user_profile, medium=True),
avatar_source = user_profile.avatar_source,
# Stream message notification settings:
stream_desktop_notifications_enabled = user_profile.enable_stream_desktop_notifications,
# Private message and @-mention notification settings:
desktop_notifications_enabled = desktop_notifications_enabled,
pm_content_in_desktop_notifications = user_profile.pm_content_in_desktop_notifications,
@@ -264,6 +261,7 @@ def home_real(request):
'enable_offline_push_notifications',
'enable_online_push_notifications',
'enable_sounds',
'enable_stream_desktop_notifications',
'enable_stream_sounds',
'hotspots',
'last_event_id',