Skip to content

Commit bc2426f

Browse files
authored
Merge pull request #12584 from nextcloud/fix/read-marker
fix(MessagesList): fix unread marker when it is attached to the last message in collapsed group
2 parents 2dbce99 + aff48e0 commit bc2426f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/components/MessagesList/MessagesList.vue

Lines changed: 13 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,18 @@ 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 system message.
974+
// Look for the unread marker itself
975+
el = document.querySelector('.new-message-marker')
976+
if (el) {
977+
el = el.closest('.message')
978+
} else {
979+
console.warn('Visual last read message element not found')
980+
}
981+
}
970982
}
971983
972984
return el

0 commit comments

Comments
 (0)