feat: block replies during agent bot ownership
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user