feat: block replies during agent bot ownership

This commit is contained in:
Sojan Jose
2026-06-28 20:10:46 -07:00
parent d0b1c055e8
commit b9834c3a18
7 changed files with 94 additions and 12 deletions
@@ -223,8 +223,11 @@ const actions = {
}
},
setCurrentChatAssignee({ commit }, { conversationId, assignee }) {
commit(types.ASSIGN_AGENT, { conversationId, assignee });
setCurrentChatAssignee(
{ commit },
{ conversationId, assignee, assigneeType }
) {
commit(types.ASSIGN_AGENT, { conversationId, assignee, assigneeType });
},
assignTeam: async ({ dispatch }, { conversationId, teamId }) => {
@@ -108,10 +108,13 @@ export const mutations = {
}
},
[types.ASSIGN_AGENT](_state, { conversationId, assignee }) {
[types.ASSIGN_AGENT](_state, { conversationId, assignee, assigneeType }) {
const chat = getConversationById(_state)(conversationId);
if (chat) {
chat.meta.assignee = assignee;
if (assigneeType !== undefined) {
chat.meta.assignee_type = assigneeType;
}
}
},
@@ -716,6 +716,21 @@ describe('#mutations', () => {
expect(state.allConversations[0].meta.assignee).toEqual(assignee);
expect(state.allConversations[1].meta.assignee).toBeUndefined();
});
it('should update assignee type when provided', () => {
const assignee = { id: 1, name: 'Agent' };
const state = {
allConversations: [{ id: 1, meta: { assignee_type: 'AgentBot' } }],
};
mutations[types.ASSIGN_AGENT](state, {
conversationId: 1,
assignee,
assigneeType: 'User',
});
expect(state.allConversations[0].meta.assignee_type).toEqual('User');
});
});
describe('#ASSIGN_PRIORITY', () => {