summaryrefslogtreecommitdiffstats
path: root/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
diff options
context:
space:
mode:
authorMarco Ambrosini <marcoambrosini@pm.me>2020-08-25 09:44:49 +0200
committerMarco Ambrosini <marcoambrosini@pm.me>2020-08-25 10:49:17 +0200
commit17e3e5261ba597c7484f7fc4a7a661e9f1960d43 (patch)
tree861e7f6c665a5120bf829dcc701c111756c99346 /src/components/LeftSidebar/ConversationsList/ConversationsList.vue
parent70d1937038722160e2a88f361707c149584f0fa5 (diff)
Fix attributes spacing
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'src/components/LeftSidebar/ConversationsList/ConversationsList.vue')
-rw-r--r--src/components/LeftSidebar/ConversationsList/ConversationsList.vue6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
index d7c0b6eea..3ee7d843c 100644
--- a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
+++ b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
@@ -78,9 +78,11 @@ export default {
return conversations.sort(this.sortConversations)
},
},
+
beforeMount() {
this.fetchConversations()
},
+
mounted() {
/** Refreshes the conversations every 30 seconds */
window.setInterval(() => {
@@ -92,10 +94,12 @@ export default {
EventBus.$on('routeChange', this.onRouteChange)
EventBus.$on('shouldRefreshConversations', this.debounceFetchConversations)
},
+
beforeDestroy() {
EventBus.$off('routeChange', this.onRouteChange)
EventBus.$off('shouldRefreshConversations', this.debounceFetchConversations)
},
+
methods: {
onRouteChange({ from, to }) {
if (from.name === 'conversation') {
@@ -106,6 +110,7 @@ export default {
this.$store.dispatch('markConversationRead', to.params.token)
}
},
+
sortConversations(conversation1, conversation2) {
if (conversation1.isFavorite !== conversation2.isFavorite) {
return conversation1.isFavorite ? -1 : 1
@@ -150,6 +155,7 @@ export default {
this.isFetchingConversations = false
}
},
+
// Emit the click event so the search text in the leftsidebar can be reset.
handleConversationClick() {
this.$emit('click-conversation')