feat(realtime): complete fake channel reply flow

This commit is contained in:
2026-07-13 14:57:28 +08:00
parent a712b91982
commit d16bb55d91
24 changed files with 1441 additions and 840 deletions
File diff suppressed because it is too large Load Diff
@@ -549,9 +549,6 @@ function onToggleAdvanceFiltersModal() {
}
function fetchConversations() {
if (chatListLoading.value) {
return;
}
store.dispatch('updateChatListFilters', conversationFilters.value);
store.dispatch('fetchAllConversations').then(emitConversationLoaded);
}
@@ -78,7 +78,7 @@ const getters = {
const currentUserID = rootGetters.getCurrentUser?.id;
return _state.allConversations.filter(conversation => {
const { assignee } = conversation.meta;
const { assignee } = conversation.meta || {};
const isAssignedToMe = assignee && assignee.id === currentUserID;
const shouldFilter = applyPageFilters(conversation, activeFilters);
const isChatMine = isAssignedToMe && shouldFilter;
@@ -59,7 +59,6 @@ export const buildConversationList = (
'conversationLabels/setBulkConversationLabels',
conversationList
);
context.commit(types.CLEAR_LIST_LOADING_STATUS);
setContacts(context.commit, conversationList);
setPageFilter({
dispatch: context.dispatch,
@@ -242,6 +242,8 @@ export const mutations = {
},
[types.UPDATE_CONVERSATION](_state, conversation) {
if (!conversation?.id) return;
const { allConversations } = _state;
const index = allConversations.findIndex(c => c.id === conversation.id);
@@ -758,6 +758,22 @@ describe('#mutations', () => {
});
describe('#UPDATE_CONVERSATION', () => {
it('should ignore malformed realtime payloads without an id', () => {
const state = {
allConversations: [{ id: 1, status: 'open', meta: {} }],
conversationFilters: {},
};
mutations[types.UPDATE_CONVERSATION](state, {
conversation: { id: 1 },
message: { id: 2 },
});
expect(state.allConversations).toEqual([
{ id: 1, status: 'open', meta: {} },
]);
});
it('should update existing conversation', () => {
const state = {
allConversations: [