sent_by_human: Add "test suite" to the set of Zulip UI-style clients.

Earlier, when we used 'self.send_message()' in the backend tests,
the sent message was not marked as read for the sender.

Reason: To set the read flag, we have to check if
'message.sent_by_human()'. It returns False because the
'sending_client' for tests is "test suite" and the 'sent_by_human'
function doesn't enlist the "test suite" client name as a human client.

This commit adds "test suite" to that list.

Also fixes a bug in when apply_unread_message_event was called that
was revealed by this change.
This commit is contained in:
Prakhar Pratyush
2023-09-30 16:10:39 +05:30
committed by Tim Abbott
parent 68abc6af21
commit c349d1137c
7 changed files with 87 additions and 63 deletions

View File

@@ -718,7 +718,7 @@ def apply_event(
) -> None:
if event["type"] == "message":
state["max_message_id"] = max(state["max_message_id"], event["message"]["id"])
if "raw_unread_msgs" in state:
if "raw_unread_msgs" in state and "read" not in event["flags"]:
apply_unread_message_event(
user_profile,
state["raw_unread_msgs"],