feat: Refetch the active conversation messages on action cable reconnect (#6790)

This commit is contained in:
Muhsin Keloth
2023-04-24 10:17:12 +05:30
committed by GitHub
parent 474e65f4c8
commit 815322b27a
7 changed files with 204 additions and 11 deletions

View File

@@ -30,6 +30,36 @@ class ActionCableConnector extends BaseActionCableConnector {
};
}
onReconnect = () => {
this.syncActiveConversationMessages();
};
onDisconnected = () => {
this.setActiveConversationLastMessageId();
};
setActiveConversationLastMessageId = () => {
const {
params: { conversation_id },
} = this.app.$route;
if (conversation_id) {
this.app.$store.dispatch('setConversationLastMessageId', {
conversationId: Number(conversation_id),
});
}
};
syncActiveConversationMessages = () => {
const {
params: { conversation_id },
} = this.app.$route;
if (conversation_id) {
this.app.$store.dispatch('syncActiveConversationMessages', {
conversationId: Number(conversation_id),
});
}
};
isAValidEvent = data => {
return this.app.$store.getters.getCurrentAccountId === data.account_id;
};