Skip to content

Commit df2f037

Browse files
authored
fix: Default priorities name not being translated in sidebar room menu (#36813)
1 parent 2c732a5 commit df2f037

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

.changeset/metal-jobs-learn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket.chat/meteor': patch
3+
---
4+
5+
Fixes an issue where the omnichannel default priorities are not being translated in the sidebar room menu

.changeset/slow-ants-divide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@rocket.chat/meteor': patch
33
---
44

5-
Fixes an issue where the omnichannel default priorities are not being translated
5+
Fixes an issue where the omnichannel default priorities are not being translated in priorities list

apps/meteor/client/omnichannel/hooks/useOmnichannelPrioritiesMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const useOmnichannelPrioritiesMenu = (rid: IRoom['_id']) => {
3737
};
3838

3939
const options = priorities.map(({ _id: priorityId, name, i18n, dirty, sortItem }) => {
40-
const label = dirty && name ? name : i18n;
40+
const label = dirty && name ? name : t(i18n);
4141

4242
return {
4343
id: priorityId,
@@ -49,5 +49,5 @@ export const useOmnichannelPrioritiesMenu = (rid: IRoom['_id']) => {
4949
});
5050

5151
return priorities.length ? [unprioritizedOption, ...options] : [];
52-
}, [t, priorities, updateRoomPriority, removeRoomPriority, queryClient, rid]);
52+
}, [t, priorities, updateRoomPriority, removeRoomPriority, queryClient, rid, dispatchToastMessage]);
5353
};

apps/meteor/client/sidebar/hooks/useRoomMenuActions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const useRoomMenuActions = ({
5858
const menuOptions = useMemo(
5959
() =>
6060
!hideDefaultOptions
61-
? [
61+
? ([
6262
!isOmnichannelRoom && {
6363
id: 'hideRoom',
6464
icon: 'eye-off',
@@ -83,7 +83,7 @@ export const useRoomMenuActions = ({
8383
content: t('Leave_room'),
8484
onClick: handleLeave,
8585
},
86-
]
86+
].filter(Boolean) as GenericMenuItemProps[])
8787
: [],
8888
[
8989
hideDefaultOptions,
@@ -102,10 +102,10 @@ export const useRoomMenuActions = ({
102102

103103
if (isOmnichannelRoom && prioritiesMenu.length > 0) {
104104
return [
105-
{ title: '', items: menuOptions.filter(Boolean) as GenericMenuItemProps[] },
106-
{ title: t('Priorities'), items: prioritiesMenu },
105+
...(menuOptions.length > 0 ? [{ title: '', items: menuOptions }] : []),
106+
...(prioritiesMenu.length > 0 ? [{ title: t('Priorities'), items: prioritiesMenu }] : []),
107107
];
108108
}
109109

110-
return [{ title: '', items: menuOptions.filter(Boolean) as GenericMenuItemProps[] }];
110+
return menuOptions.length > 0 ? [{ title: '', items: menuOptions }] : [];
111111
};

0 commit comments

Comments
 (0)