From b3e86dbab453d27f397b2f78865894b3178c9473 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Fri, 14 Sep 2018 16:27:41 +0300 Subject: [PATCH] Fix unread markers not rendering with hidden status messages Co-Authored-By: Richard Lewis --- client/components/MessageList.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/client/components/MessageList.vue b/client/components/MessageList.vue index a11866dc..52630a37 100644 --- a/client/components/MessageList.vue +++ b/client/components/MessageList.vue @@ -24,7 +24,7 @@ :key="message.id + '-date'" :message="message" />
@@ -188,6 +188,9 @@ export default { } }); }, + beforeUpdate() { + this.unreadMarkerShown = false; + }, beforeDestroy() { this.$root.$off("resize", this.handleResize); this.$refs.chat.removeEventListener("scroll", this.debouncedScroll); @@ -208,13 +211,12 @@ export default { return (new Date(previousMessage.time)).getDay() !== (new Date(message.time)).getDay(); }, shouldDisplayUnreadMarker(id) { - const previousMessage = this.condensedMessages[id - 1]; - - if (!previousMessage) { - return false; + if (!this.unreadMarkerShown && id > this.channel.firstUnread) { + this.unreadMarkerShown = true; + return true; } - return this.channel.firstUnread === previousMessage.id; + return false; }, onCopy() { clipboard(this.$el);