mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
Fix apply_unread_message_event() for mentions.
We were exiting this function in certain cases before updating mentions. This bug was always there, but it was flaky in terms of database setup whether the tests would fail, so now the relevant test sends three consecutive messages. We also avoid putting duplicate message ids in mentions.
This commit is contained in:
@@ -518,6 +518,10 @@ def apply_unread_message_event(state, message):
|
||||
unread_message_ids=[message_id],
|
||||
)
|
||||
|
||||
if message.get('is_mentioned'):
|
||||
if message_id not in state['mentions']:
|
||||
state['mentions'].append(message_id)
|
||||
|
||||
for obj in state[unread_key]:
|
||||
if key_func(obj) == my_key:
|
||||
obj['unread_message_ids'].append(message_id)
|
||||
@@ -526,6 +530,3 @@ def apply_unread_message_event(state, message):
|
||||
|
||||
state[unread_key].append(new_obj)
|
||||
state[unread_key].sort(key=key_func)
|
||||
|
||||
if message.get('is_mentioned'):
|
||||
state['mentions'].append(message_id)
|
||||
|
||||
Reference in New Issue
Block a user