mirror of https://github.com/zulip/zulip.git
[manual] Handle old and new notify_tornado payloads
This commit must be deployed standalone, before the following commits (imported from commit bb695cd39f51baacb02fd219329305fabf7c4702)
This commit is contained in:
parent
9454683108
commit
1d279abdcf
|
@ -253,7 +253,25 @@ def process_new_message(data):
|
|||
|
||||
message_dict_markdown = message.to_dict(True)
|
||||
message_dict_no_markdown = message.to_dict(False)
|
||||
for user_profile_id in data['users']:
|
||||
|
||||
user_flags = {}
|
||||
user_ids = []
|
||||
users = data.get('users', [])
|
||||
first = users[0] if len(users) else None
|
||||
# TODO(leo)
|
||||
# We can remove this support for old payloads (the elif int case)
|
||||
# once we have deployed the new format to prod
|
||||
if type(first) == dict:
|
||||
# We modified the users list to be a list of {id, flag} maps
|
||||
for user_data in data['users']:
|
||||
id = user_data['id']
|
||||
user_ids.append(id)
|
||||
user_flags[id] = user_data.get('flags', [])
|
||||
elif type(first) == int:
|
||||
user_ids = data['users']
|
||||
|
||||
|
||||
for user_profile_id in user_ids:
|
||||
user_receive_message(user_profile_id, message)
|
||||
|
||||
for client in get_client_descriptors_for_user(user_profile_id):
|
||||
|
|
Loading…
Reference in New Issue