mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
feat: Adds automation view for assigning an agent (#6131)
* feat: Adds automation view for assigning an agent Co-authored-by: Tejaswini Chile <tejaswini@chatwoot.com> Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -97,8 +97,9 @@ export const generateConditionOptions = (options, key = 'id') => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getActionOptions = ({ teams, labels, type }) => {
|
export const getActionOptions = ({ agents, teams, labels, type }) => {
|
||||||
const actionsMap = {
|
const actionsMap = {
|
||||||
|
assign_agent: agents,
|
||||||
assign_team: teams,
|
assign_team: teams,
|
||||||
send_email_to_team: teams,
|
send_email_to_team: teams,
|
||||||
add_label: generateConditionOptions(labels, 'title'),
|
add_label: generateConditionOptions(labels, 'title'),
|
||||||
@@ -178,7 +179,7 @@ export const getDefaultConditions = eventName => {
|
|||||||
export const getDefaultActions = () => {
|
export const getDefaultActions = () => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
action_name: 'assign_team',
|
action_name: 'assign_agent',
|
||||||
action_params: [],
|
action_params: [],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -213,7 +214,7 @@ export const isCustomAttribute = (attrs, key) => {
|
|||||||
|
|
||||||
export const generateCustomAttributes = (
|
export const generateCustomAttributes = (
|
||||||
conversationAttributes = [],
|
conversationAttributes = [],
|
||||||
contactAttribtues = [],
|
contactAttributes = [],
|
||||||
conversationlabel,
|
conversationlabel,
|
||||||
contactlabel
|
contactlabel
|
||||||
) => {
|
) => {
|
||||||
@@ -228,14 +229,14 @@ export const generateCustomAttributes = (
|
|||||||
...conversationAttributes
|
...conversationAttributes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (contactAttribtues.length) {
|
if (contactAttributes.length) {
|
||||||
customAttributes.push(
|
customAttributes.push(
|
||||||
{
|
{
|
||||||
key: `contact_custom_attribute`,
|
key: `contact_custom_attribute`,
|
||||||
name: contactlabel,
|
name: contactlabel,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
...contactAttribtues
|
...contactAttributes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return customAttributes;
|
return customAttributes;
|
||||||
|
|||||||
@@ -250,8 +250,8 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
getActionDropdownValues(type) {
|
getActionDropdownValues(type) {
|
||||||
const { labels, teams } = this;
|
const { agents, labels, teams } = this;
|
||||||
return getActionOptions({ labels, teams, type });
|
return getActionOptions({ agents, labels, teams, type });
|
||||||
},
|
},
|
||||||
manifestCustomAttributes() {
|
manifestCustomAttributes() {
|
||||||
const conversationCustomAttributesRaw = this.$store.getters[
|
const conversationCustomAttributesRaw = this.$store.getters[
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ export default {
|
|||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
action_name: 'assign_team',
|
action_name: 'assign_agent',
|
||||||
action_params: [],
|
action_params: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ export const AUTOMATIONS = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
|
{
|
||||||
|
key: 'assign_agent',
|
||||||
|
name: 'Assign to agent',
|
||||||
|
attributeI18nKey: 'ASSIGN_AGENT',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'assign_team',
|
key: 'assign_team',
|
||||||
name: 'Assign a team',
|
name: 'Assign a team',
|
||||||
@@ -129,6 +134,11 @@ export const AUTOMATIONS = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
|
{
|
||||||
|
key: 'assign_agent',
|
||||||
|
name: 'Assign to agent',
|
||||||
|
attributeI18nKey: 'ASSIGN_AGENT',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'assign_team',
|
key: 'assign_team',
|
||||||
name: 'Assign a team',
|
name: 'Assign a team',
|
||||||
@@ -241,6 +251,11 @@ export const AUTOMATIONS = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
|
{
|
||||||
|
key: 'assign_agent',
|
||||||
|
name: 'Assign to agent',
|
||||||
|
attributeI18nKey: 'ASSIGN_AGENT',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'assign_team',
|
key: 'assign_team',
|
||||||
name: 'Assign a team',
|
name: 'Assign a team',
|
||||||
@@ -311,6 +326,11 @@ export const AUTOMATION_RULE_EVENTS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const AUTOMATION_ACTION_TYPES = [
|
export const AUTOMATION_ACTION_TYPES = [
|
||||||
|
{
|
||||||
|
key: 'assign_agent',
|
||||||
|
label: 'Assign to agent',
|
||||||
|
inputType: 'search_select',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'assign_team',
|
key: 'assign_team',
|
||||||
label: 'Assign a team',
|
label: 'Assign a team',
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ describe('automationMethodsMixin', () => {
|
|||||||
it('getDefaultActions returns the resp default action model', () => {
|
it('getDefaultActions returns the resp default action model', () => {
|
||||||
const genericActionModel = [
|
const genericActionModel = [
|
||||||
{
|
{
|
||||||
action_name: 'assign_team',
|
action_name: 'assign_agent',
|
||||||
action_params: [],
|
action_params: [],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ describe('automationMethodsMixin', () => {
|
|||||||
|
|
||||||
it('appendNewAction appends a new condition to the automation data property', () => {
|
it('appendNewAction appends a new condition to the automation data property', () => {
|
||||||
const action = {
|
const action = {
|
||||||
action_name: 'assign_team',
|
action_name: 'assign_agent',
|
||||||
action_params: [],
|
action_params: [],
|
||||||
};
|
};
|
||||||
const data = () => {
|
const data = () => {
|
||||||
@@ -339,6 +339,9 @@ describe('automationMethodsMixin', () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
const computed = {
|
const computed = {
|
||||||
|
agents() {
|
||||||
|
return agents;
|
||||||
|
},
|
||||||
labels() {
|
labels() {
|
||||||
return labels;
|
return labels;
|
||||||
},
|
},
|
||||||
@@ -419,6 +422,9 @@ describe('automationMethodsMixin', () => {
|
|||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
const computed = {
|
const computed = {
|
||||||
|
agents() {
|
||||||
|
return agents;
|
||||||
|
},
|
||||||
labels() {
|
labels() {
|
||||||
return labels;
|
return labels;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ module ActivityMessageHandler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_assignee_change_activity(user_name)
|
def create_assignee_change_activity(user_name)
|
||||||
|
user_name = activity_message_ownner(user_name)
|
||||||
|
|
||||||
return unless user_name
|
return unless user_name
|
||||||
|
|
||||||
content = generate_assignee_change_activity_content(user_name)
|
content = generate_assignee_change_activity_content(user_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user