mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
add_new_user_history: Add missing historical flags.
This commit adds the missing historical flag to recent messages added in a new user's feed. Reason: * User didn't receive when they were sent, so semantically the 'historical' flag should be present. * It helps to avoid the "You (un)subscribed to.." bookend while reading older messages. The bookend appears whenever the historical flag flips between adjacent messages. Earlier, the bookend was visible between 'recent messages' and 'older messages'. This makes sure that the bookend is visible only at the moment new message is sent by the user after account creation.
This commit is contained in:
committed by
Tim Abbott
parent
f5a0755f16
commit
485a8a1421
@@ -266,7 +266,7 @@ class AddNewUserHistoryTest(ZulipTestCase):
|
||||
self.assertTrue(
|
||||
UserMessage.objects.filter(user_profile=user_profile, message_id=message_id).exists()
|
||||
)
|
||||
# The race message is in the user's history and marked unread.
|
||||
# The race message is in the user's history, marked unread & NOT historical.
|
||||
self.assertTrue(
|
||||
UserMessage.objects.filter(
|
||||
user_profile=user_profile, message_id=race_message_id
|
||||
@@ -277,9 +277,14 @@ class AddNewUserHistoryTest(ZulipTestCase):
|
||||
user_profile=user_profile, message_id=race_message_id
|
||||
).flags.read.is_set
|
||||
)
|
||||
self.assertFalse(
|
||||
UserMessage.objects.get(
|
||||
user_profile=user_profile, message_id=race_message_id
|
||||
).flags.historical.is_set
|
||||
)
|
||||
|
||||
# Verify that the MAX_NUM_RECENT_UNREAD_MESSAGES latest messages
|
||||
# that weren't the race message are marked as unread.
|
||||
# that weren't the race message are marked as unread & historical.
|
||||
latest_messages = (
|
||||
UserMessage.objects.filter(
|
||||
user_profile=user_profile,
|
||||
@@ -291,8 +296,9 @@ class AddNewUserHistoryTest(ZulipTestCase):
|
||||
self.assert_length(latest_messages, 2)
|
||||
for msg in latest_messages:
|
||||
self.assertFalse(msg.flags.read.is_set)
|
||||
self.assertTrue(msg.flags.historical.is_set)
|
||||
|
||||
# Verify that older messages are correctly marked as read.
|
||||
# Verify that older messages are correctly marked as read & historical.
|
||||
older_messages = (
|
||||
UserMessage.objects.filter(
|
||||
user_profile=user_profile,
|
||||
@@ -306,6 +312,7 @@ class AddNewUserHistoryTest(ZulipTestCase):
|
||||
self.assertGreater(len(older_messages), 0)
|
||||
for msg in older_messages:
|
||||
self.assertTrue(msg.flags.read.is_set)
|
||||
self.assertTrue(msg.flags.historical.is_set)
|
||||
|
||||
def test_auto_subbed_to_personals(self) -> None:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user