Optimize jump to unread to reduce flicker on large backlog load.

This commit is contained in:
Jack Kingsman
2026-07-25 17:53:34 -07:00
parent 1584151000
commit f2006e15ba
12 changed files with 163 additions and 228 deletions
+17
View File
@@ -1005,6 +1005,23 @@ class TestReadStateEndpoints:
assert result["last_read_ats"][f"channel-{chan_key}"] == 1000
assert result["last_read_ats"][f"contact-{contact_key}"] == 1000
# The oldest unread message per conversation, used by the client to place
# the unread divider without paging back through history.
first_chan = await MessageRepository.get_by_content(
msg_type="CHAN",
conversation_key=chan_key,
text="Bob: hello",
sender_timestamp=1001,
)
assert result["first_unread_ids"][f"channel-{chan_key}"] == first_chan.id
first_dm = await MessageRepository.get_by_content(
msg_type="PRIV",
conversation_key=contact_key,
text="hi @[TeStUsEr] there",
sender_timestamp=1005,
)
assert result["first_unread_ids"][f"contact-{contact_key}"] == first_dm.id
@pytest.mark.asyncio
async def test_get_unreads_no_name_skips_mentions(self, test_db):
"""Unreads without a radio name returns counts but no mention flags."""