fix: Disable "none" option from agent dropdown If agent is not selected (#2687)

This commit is contained in:
Muhsin Keloth 2021-07-22 16:31:53 +05:30 committed by GitHub
parent a7ca55c080
commit 6b6df7a70d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 9 deletions

View file

@ -10,17 +10,24 @@ export default {
...mapGetters({
currentUser: 'getCurrentUser',
}),
isAgentSelected() {
return this.currentChat?.meta?.assignee;
},
agentsList() {
const agents = this.assignableAgents || [];
return [
{
confirmed: true,
name: 'None',
id: 0,
role: 'agent',
account_id: 0,
email: 'None',
},
...(this.isAgentSelected
? [
{
confirmed: true,
name: 'None',
id: 0,
role: 'agent',
account_id: 0,
email: 'None',
},
]
: []),
...agents,
].map(item =>
item.id === this.currentUser.id

View file

@ -24,7 +24,10 @@ describe('agentMixin', () => {
title: 'TestComponent',
mixins: [agentMixin],
data() {
return { inboxId: 1 };
return {
inboxId: 1,
currentChat: { meta: { assignee: { name: 'John' } } },
};
},
computed: {
assignableAgents() {