diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 25ff074fc4..a633016e32 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -1744,8 +1744,7 @@ def do_update_message(user_profile, message_id, subject, propagate_mode, content 'id': um.user_profile_id, 'flags': um.flags_list() } - notice = dict(event=event, users=map(user_info, ums), type='update_message') - tornado_callbacks.send_notification(notice) + send_event(event, map(user_info, ums)) def encode_email_address(stream): return encode_email_address_helper(stream.name, stream.email_token) diff --git a/zerver/tornado_callbacks.py b/zerver/tornado_callbacks.py index 58928d7f23..01739201df 100644 --- a/zerver/tornado_callbacks.py +++ b/zerver/tornado_callbacks.py @@ -197,25 +197,27 @@ def process_event(data): if client.accepts_event(event): client.add_event(event.copy()) -def process_update_message(data): - event = data['event'] - for user in data['users']: - user_profile_id = user['id'] - user_event = event.copy() # shallow, but deep enough for our needs - user_event['flags'] = user['flags'] +def process_userdata_event(data): + raw_event = data['event'] + for user_data in data['users']: + user_profile_id = user_data['id'] + user_event = raw_event.copy() # shallow, but deep enough for our needs + for key in user_data.keys(): + if key != "id": + user_event[key] = user_data[key] for client in get_client_descriptors_for_user(user_profile_id): if client.accepts_event(user_event): client.add_event(user_event) def process_notification(data): - if 'type' not in data: + if data['event']['type'] in ["update_message"]: + process_userdata_event(data) + elif 'type' not in data: # Generic event that doesn't need special handling process_event(data) elif data['type'] == 'new_message': process_new_message(data) - elif data['type'] == 'update_message': - process_update_message(data) else: raise JsonableError('bad notification type ' + data['type'])