mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-10-30 23:51:57 +01:00
Opening a channel always landed on the newest message, so catching up on a busy channel meant scrolling up and hunting for the last familiar message. Both message lists now draw a divider at the read/unread boundary and open on it instead of at the bottom. The boundary is frozen on entry (unreadAnchorTs / dmUnreadAnchorTs) because displayMessages marks the view read on every render and would otherwise erase it before it could be drawn. It is recomputed only on a channel or conversation switch, so resyncs, the geo-cache re-render and the 60s DM refresh keep the divider in place rather than making it vanish a second after arriving. No divider when there is nothing to catch up on, on a first visit (last_seen 0) or in the archive view. When every loaded message is unread the divider renders first but the view stays at the bottom — the list already starts there and scrolling would imply history above it. Also fixes two scroll-position bugs this exposed: - DM displayMessages scrolled to the bottom unconditionally, so the periodic refresh yanked anyone reading history. It now honours a dmIsUserScrolling flag, matching channel chat. - Sending resets the flag in both views; without it a user parked at the divider would send into a part of the list they cannot see. Verified in Chrome against the local container across light/dark and desktop/mobile: boundary lands between the anchor and the next message, divider spans the full width in both flex lists, filter hides it, and an incoming message leaves the view parked while an own send drops to bottom. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>