feat: add timeout before marking as read

This commit is contained in:
Shivam Mishra
2025-02-25 17:43:40 +05:30
parent 4d588ae618
commit bb32937b1b
@@ -115,6 +115,7 @@ export default {
isProgrammaticScroll: false,
messageSentSinceOpened: false,
labelSuggestions: [],
markReadTimeout: null,
};
},
@@ -272,6 +273,7 @@ export default {
}
this.fetchAllAttachmentsFromCurrentChat();
this.fetchSuggestions();
this.removeMarkReadTimeout();
this.messageSentSinceOpened = false;
},
},
@@ -296,6 +298,7 @@ export default {
unmounted() {
this.removeBusListeners();
this.removeScrollListener();
this.removeMarkReadTimeout();
},
methods: {
@@ -362,7 +365,9 @@ export default {
this.scrollToBottom();
}
});
this.makeMessagesRead();
this.markReadTimeout = setTimeout(this.makeMessagesRead, 5000, {
once: true,
});
},
addScrollListener() {
this.conversationPanel = this.$el.querySelector('.conversation-panel');
@@ -473,6 +478,9 @@ export default {
return false;
});
},
removeMarkReadTimeout() {
clearTimeout(this.markReadTimeout);
},
},
};
</script>