fix: reopen pending human conversations
Build and publish Docker images / Build and publish images (push) Successful in 2m23s

This commit is contained in:
2026-09-14 18:55:51 +08:00
parent 665e531dc3
commit 9b8d575657
7 changed files with 121 additions and 14 deletions
@@ -0,0 +1,59 @@
import { shallowMount } from '@vue/test-utils';
import { createStore } from 'vuex';
import { describe, expect, it } from 'vitest';
import ConversationWrap from './ConversationWrap.vue';
const mountConversation = ({
status = 'pending',
aiTakeoverActive = false,
isAgentTyping = false,
messageType = 0,
} = {}) =>
shallowMount(ConversationWrap, {
props: { groupedMessages: [] },
global: {
plugins: [
createStore({
getters: {
'appConfig/darkMode': () => 'light',
'conversation/getEarliestMessage': () => ({ id: 1 }),
'conversation/getLastMessage': () => ({
message_type: messageType,
}),
'conversation/getAllMessagesLoaded': () => true,
'conversation/getIsFetchingList': () => false,
'conversation/getConversationSize': () => 1,
'conversation/getIsAgentTyping': () => isAgentTyping,
'conversationAttributes/getConversationParams': () => ({
id: 1,
status,
aiTakeoverActive,
}),
},
}),
],
},
});
describe('ConversationWrap', () => {
it('does not show typing for an ordinary pending conversation', () => {
const wrapper = mountConversation();
expect(wrapper.vm.showStatusIndicator).toBe(false);
});
it('shows typing while an AI takeover is waiting for a reply', () => {
const wrapper = mountConversation({ aiTakeoverActive: true });
expect(wrapper.vm.showStatusIndicator).toBe(true);
});
it('shows typing when an explicit agent typing event is active', () => {
const wrapper = mountConversation({
status: 'open',
isAgentTyping: true,
});
expect(wrapper.vm.showStatusIndicator).toBe(true);
});
});
@@ -45,14 +45,10 @@ export default {
return `${this.darkMode === 'dark' ? 'dark-scheme' : 'light-scheme'}`;
},
showStatusIndicator() {
const { status } = this.conversationAttributes;
const isConversationInPendingStatus = status === 'pending';
const { aiTakeoverActive } = this.conversationAttributes;
const isLastMessageIncoming =
this.lastMessage.message_type === MESSAGE_TYPE.INCOMING;
return (
this.isAgentTyping ||
(isConversationInPendingStatus && isLastMessageIncoming)
);
return this.isAgentTyping || (aiTakeoverActive && isLastMessageIncoming);
},
},
watch: {