fix(conversations): sync AI takeover exit in realtime (#6)
Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
@@ -891,7 +891,6 @@ export default {
|
||||
);
|
||||
if (sentMessage?.ai_takeover_exited) {
|
||||
useAlert(this.$t('CONVERSATION.AI_TAKEOVER.EXIT_SUCCESS'));
|
||||
await this.$store.dispatch('getConversation', this.conversationId);
|
||||
}
|
||||
emitter.emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
|
||||
emitter.emit(BUS_EVENTS.MESSAGE_SENT);
|
||||
|
||||
@@ -160,4 +160,22 @@ describe('ActionCableConnector - Copilot Tests', () => {
|
||||
expect(mockDispatch).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
it('updates AI takeover state from conversation.updated', () => {
|
||||
const conversation = {
|
||||
id: 42,
|
||||
account_id: 1,
|
||||
ai_takeover_active: false,
|
||||
};
|
||||
|
||||
actionCable.onReceived({
|
||||
event: 'conversation.updated',
|
||||
data: conversation,
|
||||
});
|
||||
|
||||
expect(mockDispatch).toHaveBeenCalledWith(
|
||||
'updateConversation',
|
||||
conversation
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user