Fix multiple unread divider

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-12-13 11:03:48 +05:30
parent 90c6b18cbb
commit 6d5d40b8e3

View file

@ -83,7 +83,9 @@ function handleOnClickCapture(e) {
} }
function renderEvent(roomTimeline, mEvent, prevMEvent, isFocus = false) { function renderEvent(roomTimeline, mEvent, prevMEvent, isFocus = false) {
const isBodyOnly = (prevMEvent !== null && prevMEvent.getType() !== 'm.room.member' const isBodyOnly = (prevMEvent !== null
&& prevMEvent.getType() !== 'm.room.member'
&& prevMEvent.getType() !== 'm.room.create'
&& diffMinutes(mEvent.getDate(), prevMEvent.getDate()) <= MAX_MSG_DIFF_MINUTES && diffMinutes(mEvent.getDate(), prevMEvent.getDate()) <= MAX_MSG_DIFF_MINUTES
&& prevMEvent.getSender() === mEvent.getSender() && prevMEvent.getSender() === mEvent.getSender()
); );
@ -577,6 +579,7 @@ function RoomViewContent({ eventId, roomTimeline }) {
let itemCountIndex = 0; let itemCountIndex = 0;
jumpToItemIndex = -1; jumpToItemIndex = -1;
const readEvent = readEventStore.getItem(); const readEvent = readEventStore.getItem();
let unreadDivider = false;
if (roomTimeline.canPaginateBackward() || limit.from > 0) { if (roomTimeline.canPaginateBackward() || limit.from > 0) {
tl.push(loadingMsgPlaceholders(1, PLACEHOLDER_COUNT)); tl.push(loadingMsgPlaceholders(1, PLACEHOLDER_COUNT));
@ -599,7 +602,7 @@ function RoomViewContent({ eventId, roomTimeline }) {
} }
} }
const unreadDivider = (readEvent unreadDivider = (readEvent && !unreadDivider
&& prevMEvent?.getTs() <= readEvent.getTs() && prevMEvent?.getTs() <= readEvent.getTs()
&& readEvent.getTs() < mEvent.getTs()); && readEvent.getTs() < mEvent.getTs());
if (unreadDivider) { if (unreadDivider) {