Compare commits

...
Author SHA1 Message Date
Shivam Mishra bb32937b1b feat: add timeout before marking as read 2025-02-25 17:43:40 +05:30
@@ -115,6 +115,7 @@ export default {
isProgrammaticScroll: false, isProgrammaticScroll: false,
messageSentSinceOpened: false, messageSentSinceOpened: false,
labelSuggestions: [], labelSuggestions: [],
markReadTimeout: null,
}; };
}, },
@@ -272,6 +273,7 @@ export default {
} }
this.fetchAllAttachmentsFromCurrentChat(); this.fetchAllAttachmentsFromCurrentChat();
this.fetchSuggestions(); this.fetchSuggestions();
this.removeMarkReadTimeout();
this.messageSentSinceOpened = false; this.messageSentSinceOpened = false;
}, },
}, },
@@ -296,6 +298,7 @@ export default {
unmounted() { unmounted() {
this.removeBusListeners(); this.removeBusListeners();
this.removeScrollListener(); this.removeScrollListener();
this.removeMarkReadTimeout();
}, },
methods: { methods: {
@@ -362,7 +365,9 @@ export default {
this.scrollToBottom(); this.scrollToBottom();
} }
}); });
this.makeMessagesRead(); this.markReadTimeout = setTimeout(this.makeMessagesRead, 5000, {
once: true,
});
}, },
addScrollListener() { addScrollListener() {
this.conversationPanel = this.$el.querySelector('.conversation-panel'); this.conversationPanel = this.$el.querySelector('.conversation-panel');
@@ -473,6 +478,9 @@ export default {
return false; return false;
}); });
}, },
removeMarkReadTimeout() {
clearTimeout(this.markReadTimeout);
},
}, },
}; };
</script> </script>