mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +00:00
Order the sections of fetch_initial_state_data() alphabetically.
(imported from commit cef5471660df1bdacf7d5ea18c8c629aec3e4bf4)
This commit is contained in:
@@ -1955,6 +1955,9 @@ def fetch_initial_state_data(user_profile, event_types, queue_id):
|
|||||||
else:
|
else:
|
||||||
want = set(event_types).__contains__
|
want = set(event_types).__contains__
|
||||||
|
|
||||||
|
if want('alert_words'):
|
||||||
|
state['alert_words'] = user_alert_words(user_profile)
|
||||||
|
|
||||||
if want('message'):
|
if want('message'):
|
||||||
# The client should use get_old_messages() to fetch messages
|
# The client should use get_old_messages() to fetch messages
|
||||||
# starting with the max_message_id. They will get messages
|
# starting with the max_message_id. They will get messages
|
||||||
@@ -1965,45 +1968,42 @@ def fetch_initial_state_data(user_profile, event_types, queue_id):
|
|||||||
else:
|
else:
|
||||||
state['max_message_id'] = -1
|
state['max_message_id'] = -1
|
||||||
|
|
||||||
|
if want('muted_topics'):
|
||||||
|
state['muted_topics'] = ujson.loads(user_profile.muted_topics)
|
||||||
|
|
||||||
if want('pointer'):
|
if want('pointer'):
|
||||||
state['pointer'] = user_profile.pointer
|
state['pointer'] = user_profile.pointer
|
||||||
|
|
||||||
|
if want('presence'):
|
||||||
|
state['presences'] = get_status_dict(user_profile)
|
||||||
|
|
||||||
|
if want('realm'):
|
||||||
|
state['realm_name'] = user_profile.realm.name
|
||||||
|
|
||||||
|
if want('realm_emoji'):
|
||||||
|
state['realm_emoji'] = user_profile.realm.get_emoji()
|
||||||
|
|
||||||
|
if want('realm_filters'):
|
||||||
|
state['realm_filters'] = realm_filters_for_domain(user_profile.realm.domain)
|
||||||
|
|
||||||
if want('realm_user'):
|
if want('realm_user'):
|
||||||
state['realm_users'] = get_realm_user_dicts(user_profile)
|
state['realm_users'] = get_realm_user_dicts(user_profile)
|
||||||
|
|
||||||
|
if want('referral'):
|
||||||
|
state['referrals'] = {'granted': user_profile.invites_granted,
|
||||||
|
'used': user_profile.invites_used}
|
||||||
|
|
||||||
if want('subscriptions'):
|
if want('subscriptions'):
|
||||||
subscriptions, unsubscribed, email_dict = gather_subscriptions_helper(user_profile)
|
subscriptions, unsubscribed, email_dict = gather_subscriptions_helper(user_profile)
|
||||||
state['subscriptions'] = subscriptions
|
state['subscriptions'] = subscriptions
|
||||||
state['unsubscribed'] = unsubscribed
|
state['unsubscribed'] = unsubscribed
|
||||||
state['email_dict'] = email_dict
|
state['email_dict'] = email_dict
|
||||||
|
|
||||||
if want('presence'):
|
|
||||||
state['presences'] = get_status_dict(user_profile)
|
|
||||||
|
|
||||||
if want('referral'):
|
|
||||||
state['referrals'] = {'granted': user_profile.invites_granted,
|
|
||||||
'used': user_profile.invites_used}
|
|
||||||
|
|
||||||
if want('update_message_flags'):
|
if want('update_message_flags'):
|
||||||
# There's no initial data for message flag updates, client will
|
# There's no initial data for message flag updates, client will
|
||||||
# get any updates during a session from get_events()
|
# get any updates during a session from get_events()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if want('realm_emoji'):
|
|
||||||
state['realm_emoji'] = user_profile.realm.get_emoji()
|
|
||||||
|
|
||||||
if want('alert_words'):
|
|
||||||
state['alert_words'] = user_alert_words(user_profile)
|
|
||||||
|
|
||||||
if want('muted_topics'):
|
|
||||||
state['muted_topics'] = ujson.loads(user_profile.muted_topics)
|
|
||||||
|
|
||||||
if want('realm_filters'):
|
|
||||||
state['realm_filters'] = realm_filters_for_domain(user_profile.realm.domain)
|
|
||||||
|
|
||||||
if want('realm'):
|
|
||||||
state['realm_name'] = user_profile.realm.name
|
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
|
||||||
def apply_events(state, events, user_profile):
|
def apply_events(state, events, user_profile):
|
||||||
|
|||||||
Reference in New Issue
Block a user