ποΈ Improve unread marker display - #6484
Open
AndyScherzinger wants to merge 6 commits into
Open
Conversation
AndyScherzinger
force-pushed
the
feat/noid/msgPreFetching
branch
from
August 13, 2026 15:07
f978b99 to
1a1f664
Compare
AndyScherzinger
force-pushed
the
feat/noid/msgUnreadMarker
branch
from
August 13, 2026 21:42
74641aa to
f0bc26d
Compare
AndyScherzinger
force-pushed
the
feat/noid/msgPreFetching
branch
from
August 13, 2026 21:43
1a1f664 to
3f6a24d
Compare
AndyScherzinger
force-pushed
the
feat/noid/msgUnreadMarker
branch
from
August 13, 2026 21:43
f0bc26d to
a137536
Compare
AndyScherzinger
marked this pull request as ready for review
August 13, 2026 21:47
AndyScherzinger
force-pushed
the
feat/noid/msgUnreadMarker
branch
from
August 14, 2026 15:47
a137536 to
8c9e228
Compare
Contributor
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/31816236588/artifacts/9225804811 |
The unread marker can only be placed correctly when the chat's visible window - the latest chat block - reaches back to the last read message. For a room without any cached chat block the catch-up fetched the newest page, so any backlog larger than one page left a chat block floating entirely above the unread boundary and the marker ended up pinned to the oldest message of that block, in the middle of the unread messages. When the unread backlog is at least one page but still closable within the backlog rounds, anchor the initial fetch at lastReadMessage (including the last read message itself) and close the rest of the backlog from there, so the created chat block contains the boundary. Smaller backlogs fit into the newest page anyway and oversized backlogs could not be closed either way, so both keep the newest-messages fetch. The room list prefetch passes the conversation's lastReadMessage and unread count along, so background-prefetched rooms open with a window the marker can be placed in. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The initial load decided the cache was usable when the newest cached message id was at least the conversation's lastReadMessage. That check compares against the top of the latest chat block, not its extent: a block created by a capped newest-messages fetch (e.g. the background prefetch) floats entirely above the unread boundary and trivially passes, so the open path only closed the backlog above the block and the unread marker stayed pinned to the block's oldest message, in the middle of the unread messages. Decide on containment instead: the cache is only trusted when the latest chat block reaches back to lastReadMessage (or has no history below it). Otherwise the initial window is re-fetched via initialCatchUp, anchored at the unread boundary when the backlog is large. This also changes the handling of a cache whose latest block lies completely below lastReadMessage (read further on another device): instead of fetching the newest page into a floating block, the backlog is closed from the newest cached message, keeping the window contiguous across the boundary. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
buildChatItems latched firstUnreadMessageId on the first emission as "the first visible message newer than lastReadMessage". When the visible window did not reach back to the last read message - all visible messages unread - this resolved to the window's oldest message, far above the true boundary, and the cached value kept the marker there even after scrolling up loaded the older unread messages. Only latch the marker when a message at or below lastReadMessage is visible, proving the boundary is inside the window. Until then no marker is shown instead of a wrong one. Temporary messages have negative ids and don't count as proof. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The catch-up triggered by a push notification fetched the newest page for rooms without any cached chat block, so a large unread backlog left a chat block floating above the unread boundary β the same window shape that misplaces the unread marker on chat open. Look up the pushed room in the local conversations cache and pass its lastReadMessage and unread count to catchUpRoom, so the initial fetch is anchored at the boundary when the backlog calls for it. The boundary is room-level state and therefore not passed for thread catch-ups. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Covers loadInitialMessages' choice between trusting the cached window and re-fetching it: the backlog is closed from the newest cached message when the latest chat block reaches the last read message (or has no history below it), while a block floating above the boundary and an empty cache are repaired with a fetch anchored at lastReadMessage for large backlogs and a newest-messages fetch for small ones. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Extracts the latch condition from buildChatItems into the pure findFirstUnreadMessageId (no behavior change) and covers it: the marker position is only derived when a message at or below lastReadMessage is visible, windows floating entirely above the boundary and temporary messages with negative ids yield no marker, and a deleted or expired boundary message is handled by any older visible message. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
AndyScherzinger
force-pushed
the
feat/noid/msgUnreadMarker
branch
from
August 14, 2026 17:22
8c9e228 to
4f75c5e
Compare
Contributor
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/31823716011/artifacts/9228623568 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When entering a conversation, especially when using #6454 the read-state is not always correct / read / propagated.
This PR addresses this, implementing read-status propagation
π Checklist
/backport to stable-xx.xπ€ AI (if applicable)