SHA256
Исправить обновление непрочитанных в UI
This commit is contained in:
@@ -360,12 +360,17 @@ function createChannelReadTracker({
|
||||
const root = getChannelScrollRoot();
|
||||
const viewportHeight = root?.clientHeight || window.innerHeight || document.documentElement.clientHeight || 0;
|
||||
const thresholdTop = Math.max(0, Math.round(viewportHeight * unreadAnchorFraction));
|
||||
const visibleBottom = Math.max(thresholdTop, viewportHeight - 24);
|
||||
let seen = safeInitialSeenCount;
|
||||
for (const card of cards) {
|
||||
const localNumber = Number(card.dataset.localNumber || 0);
|
||||
if (!Number.isFinite(localNumber) || localNumber <= 0) continue;
|
||||
const rect = card.getBoundingClientRect();
|
||||
if (rect.top > thresholdTop + 1) break;
|
||||
if (rect.top > visibleBottom) break;
|
||||
if (rect.bottom < 0) {
|
||||
seen = Math.max(seen, localNumber);
|
||||
continue;
|
||||
}
|
||||
seen = Math.max(seen, localNumber);
|
||||
}
|
||||
return Math.max(safeInitialSeenCount, Math.min(seen, safeMessagesCount));
|
||||
|
||||
Reference in New Issue
Block a user