fix: Translate "None" option in agent assignment dropdown (#11060)

# Pull Request Template

## Description

This PR includes a translation update for the "None" option in the agent
assignment multi-select dropdown.

Fixes
https://linear.app/chatwoot/issue/CW-4140/none-option-in-assign-agent-multi-select-is-not-translated

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

**Test cases**
1. Check in conversation sidebar
2. Check in command bar
3. Check in participation dropdown


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
This commit is contained in:
Sivin Varghese
2025-03-12 03:19:27 +05:30
committed by GitHub
parent 50c6e50a62
commit d96ac59cca
5 changed files with 51 additions and 93 deletions

View File

@@ -1,9 +1,9 @@
import { computed } from 'vue';
import { useMapGetter } from 'dashboard/composables/store';
import { useI18n } from 'vue-i18n';
import {
getAgentsByUpdatedPresence,
getSortedAgentsByAvailability,
getCombinedAgents,
} from 'dashboard/helper/agentHelper';
/**
@@ -13,6 +13,7 @@ import {
* @returns {Object} An object containing the agents list and assignable agents.
*/
export function useAgentsList(includeNoneAgent = true) {
const { t } = useI18n();
const currentUser = useMapGetter('getCurrentUser');
const currentChat = useMapGetter('getSelectedChat');
const currentAccountId = useMapGetter('getCurrentAccountId');
@@ -21,6 +22,19 @@ export function useAgentsList(includeNoneAgent = true) {
const inboxId = computed(() => currentChat.value?.inbox_id);
const isAgentSelected = computed(() => currentChat.value?.meta?.assignee);
/**
* Creates a 'None' agent object
* @returns {Object} None agent object
*/
const createNoneAgent = () => ({
confirmed: true,
name: t('AGENT_MGMT.MULTI_SELECTOR.LIST.NONE') || 'None',
id: 0,
role: 'agent',
account_id: 0,
email: 'None',
});
/**
* @type {import('vue').ComputedRef<Array>}
*/
@@ -43,11 +57,10 @@ export function useAgentsList(includeNoneAgent = true) {
agentsByUpdatedPresence
);
return getCombinedAgents(
filteredAgentsByAvailability,
includeNoneAgent,
isAgentSelected.value
);
return [
...(includeNoneAgent && isAgentSelected.value ? [createNoneAgent()] : []),
...filteredAgentsByAvailability,
];
});
return {