home: Get pm_content_in_desktop_notifications from register_ret.

This commit is contained in:
Tim Abbott
2017-04-28 22:05:35 -07:00
parent 2a16cc1d24
commit c63466cae3
3 changed files with 4 additions and 2 deletions

View File

@@ -172,6 +172,7 @@ def fetch_initial_state_data(user_profile, event_types, queue_id,
state['enable_offline_push_notifications'] = user_profile.enable_offline_push_notifications
state['enable_online_push_notifications'] = user_profile.enable_online_push_notifications
state['enable_digest_emails'] = user_profile.enable_digest_emails
state['pm_content_in_desktop_notifications'] = user_profile.pm_content_in_desktop_notifications
if want('zulip_version'):
state['zulip_version'] = ZULIP_VERSION
@@ -438,6 +439,8 @@ def apply_event(state, event, user_profile, include_subscribers):
state['enable_online_push_notifications'] = event['setting']
elif event['notification_name'] == "enable_digest_emails":
state['enable_digest_emails'] = event['setting']
elif event['notification_name'] == "pm_content_in_desktop_notifications":
state['pm_content_in_desktop_notifications'] = event['setting']
else:
raise AssertionError("Unexpected event type %s" % (event['type'],))

View File

@@ -1151,7 +1151,6 @@ class EventsRegisterTest(ZulipTestCase):
lambda: do_change_pm_content_in_desktop_notifications(self.user_profile,
setting_value,
log=False),
state_change_expected=False,
)
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)

View File

@@ -224,7 +224,6 @@ def home_real(request):
# Private message and @-mention notification settings:
desktop_notifications_enabled = desktop_notifications_enabled,
pm_content_in_desktop_notifications = user_profile.pm_content_in_desktop_notifications,
# Realm foreign key data from register_ret.
# TODO: Rename these to match register_ret values.
@@ -270,6 +269,7 @@ def home_real(request):
'max_message_id',
'muted_topics',
'never_subscribed',
'pm_content_in_desktop_notifications',
'presences',
'queue_id',
'realm_add_emoji_by_admins_only',