From 181382b2b73f1ad3869d3d9d83921ce615d7aa99 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Wed, 15 Dec 2021 17:05:45 +0530 Subject: [PATCH] Fix show msg header after new msgs divider Signed-off-by: Ajay Bura --- src/app/organisms/room/RoomViewContent.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/organisms/room/RoomViewContent.jsx b/src/app/organisms/room/RoomViewContent.jsx index 7570619..c26fbd8 100644 --- a/src/app/organisms/room/RoomViewContent.jsx +++ b/src/app/organisms/room/RoomViewContent.jsx @@ -90,10 +90,10 @@ function handleOnClickCapture(e) { function renderEvent(roomTimeline, mEvent, prevMEvent, isFocus = false) { const isBodyOnly = (prevMEvent !== null + && prevMEvent.getSender() === mEvent.getSender() && prevMEvent.getType() !== 'm.room.member' && prevMEvent.getType() !== 'm.room.create' && diffMinutes(mEvent.getDate(), prevMEvent.getDate()) <= MAX_MSG_DIFF_MINUTES - && prevMEvent.getSender() === mEvent.getSender() ); const mDate = mEvent.getDate(); const isToday = isInSameDay(mDate, new Date()); @@ -608,11 +608,13 @@ function RoomViewContent({ eventId, roomTimeline }) { } } + let isNewEvent = false; if (!unreadDivider) { unreadDivider = (readEvent && prevMEvent?.getTs() <= readEvent.getTs() && readEvent.getTs() < mEvent.getTs()); if (unreadDivider) { + isNewEvent = true; tl.push(); itemCountIndex += 1; if (jumpToItemIndex === -1) jumpToItemIndex = itemCountIndex; @@ -628,7 +630,7 @@ function RoomViewContent({ eventId, roomTimeline }) { const isFocus = focusId === mEvent.getId(); if (isFocus) jumpToItemIndex = itemCountIndex; - tl.push(renderEvent(roomTimeline, mEvent, prevMEvent, isFocus)); + tl.push(renderEvent(roomTimeline, mEvent, isNewEvent ? null : prevMEvent, isFocus)); itemCountIndex += 1; } if (roomTimeline.canPaginateForward() || limit.getEndIndex() < timeline.length) {