Skip to content

Commit 4e5dbf1

Browse files
committed
fix(MessagesList): fix unread marker when it is attached to the last message in collapsed group
Signed-off-by: DorraJaouad <[email protected]>
1 parent 03a3e63 commit 4e5dbf1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/MessagesList/MessagesList.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ export default {
919919
920920
// When the current message is not visible (reaction or expired)
921921
// we use the next message from the list start the scroller-visibility check
922-
if (!el) {
922+
if (!el || el.offsetParent === null) {
923923
const messageId = this.$store.getters.getFirstDisplayableMessageIdAfterReadMarker(this.token, this.conversation.lastReadMessage)
924924
el = document.getElementById('message_' + messageId)
925925
}
@@ -967,6 +967,16 @@ export default {
967967
let el = document.getElementById('message_' + this.visualLastReadMessageId)
968968
if (el) {
969969
el = el.closest('.message')
970+
if (el === null || el.offsetParent === null) {
971+
// Exception: when the message remains not visible
972+
// e.g: it is the last message in collapsed group
973+
// unread marker is set to the combined group.
974+
// Look for the unread marker itself
975+
el = document.querySelector('.new-message-marker')
976+
if (el) {
977+
el = el.closest('.message')
978+
}
979+
}
970980
}
971981
972982
return el

0 commit comments

Comments
 (0)