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

@@ -15,6 +15,7 @@ const state = {
appliedFilters: [],
conversationParticipants: [],
conversationLastSeen: null,
syncConversationsMessages: {},
};
// mutations
@@ -54,6 +55,11 @@ export const mutations = {
chat.messages.unshift(...data);
}
},
[types.SET_MISSING_MESSAGES](_state, { id, data }) {
const [chat] = _state.allConversations.filter(c => c.id === id);
if (!chat) return;
Vue.set(chat, 'messages', data);
},
[types.SET_CURRENT_CHAT_WINDOW](_state, activeChat) {
if (activeChat) {
@@ -202,6 +208,13 @@ export const mutations = {
[types.CLEAR_CONVERSATION_FILTERS](_state) {
_state.appliedFilters = [];
},
[types.SET_LAST_MESSAGE_ID_IN_SYNC_CONVERSATION](
_state,
{ conversationId, messageId }
) {
_state.syncConversationsMessages[conversationId] = messageId;
},
};
export default {