diff --git a/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx b/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx index 6cebc6a19b54..b42b559e4dfa 100644 --- a/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx +++ b/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx @@ -22,6 +22,7 @@ import CloseChatModalData from '../../../../../../components/Omnichannel/modals/ import ForwardChatModal from '../../../../../../components/Omnichannel/modals/ForwardChatModal'; import ReturnChatQueueModal from '../../../../../../components/Omnichannel/modals/ReturnChatQueueModal'; import TranscriptModal from '../../../../../../components/Omnichannel/modals/TranscriptModal'; +import { useIsRoomOverMacLimit } from '../../../../../../hooks/omnichannel/useIsRoomOverMacLimit'; import { useOmnichannelRouteConfig } from '../../../../../../hooks/omnichannel/useOmnichannelRouteConfig'; import { quickActionHooks } from '../../../../../../ui'; import { useOmnichannelRoom } from '../../../../contexts/RoomContext'; @@ -296,9 +297,13 @@ export const useQuickActions = (): { }); const omnichannelRouteConfig = useOmnichannelRouteConfig(); + const manualOnHoldAllowed = useSetting('Livechat_allow_manual_on_hold'); + const hasManagerRole = useRole('livechat-manager'); - const roomOpen = room?.open && (room.u?._id === uid || hasManagerRole) && room?.lastMessage?.t !== 'livechat-close'; + const hasMonitorRole = useRole('livechat-monitor'); + + const roomOpen = room?.open && (room.u?._id === uid || hasManagerRole || hasMonitorRole) && room?.lastMessage?.t !== 'livechat-close'; const canMoveQueue = !!omnichannelRouteConfig?.returnQueue && room?.u !== undefined; const canForwardGuest = usePermission('transfer-livechat-guest'); const canSendTranscriptEmail = usePermission('send-omnichannel-chat-transcript'); @@ -311,18 +316,20 @@ export const useQuickActions = (): { const canAgentPlaceOnHold = !room.lastMessage?.token; const canPlaceChatOnHold = Boolean(manualOnHoldAllowed && canRoomBePlacedOnHold && (!restrictedOnHold || canAgentPlaceOnHold)); + const isRoomOverMacLimit = useIsRoomOverMacLimit(room); + const hasPermissionButtons = (id: string): boolean => { switch (id) { case QuickActionsEnum.MoveQueue: - return !!roomOpen && canMoveQueue; + return !isRoomOverMacLimit && !!roomOpen && canMoveQueue; case QuickActionsEnum.ChatForward: - return !!roomOpen && canForwardGuest; + return !isRoomOverMacLimit && !!roomOpen && canForwardGuest; case QuickActionsEnum.Transcript: - return canSendTranscriptEmail || (hasLicense && canSendTranscriptPDF); + return !isRoomOverMacLimit && (canSendTranscriptEmail || (hasLicense && canSendTranscriptPDF)); case QuickActionsEnum.TranscriptEmail: - return canSendTranscriptEmail; + return !isRoomOverMacLimit && canSendTranscriptEmail; case QuickActionsEnum.TranscriptPDF: - return hasLicense && canSendTranscriptPDF; + return hasLicense && !isRoomOverMacLimit && canSendTranscriptPDF; case QuickActionsEnum.CloseChat: return !!roomOpen && (canCloseRoom || canCloseOthersRoom); case QuickActionsEnum.OnHoldChat: diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index b36fb7cf0559..eab59d116b19 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -3077,7 +3077,7 @@ "Livechat_allow_manual_on_hold": "Allow agents to manually place chat On Hold", "Livechat_allow_manual_on_hold_Description": "If enabled, the agent will get the option to place a chat On Hold", "Livechat_allow_manual_on_hold_upon_agent_engagement_only": "Allow agents to manually place chat On Hold, provided the agent has sent the last message", - "Livechat_allow_manual_on_hold_upon_agent_engagement_only_Description": "If enabled, the agent will get a new option to place a chat On Hold, provided the agent has sent the last message, otherwise Agents are able to place chats onHold irrespective", + "Livechat_allow_manual_on_hold_upon_agent_engagement_only_Description": "If enabled, the agent will get a new option to place a chat On Hold, provided the agent has sent the last message, otherwise agents are able to place chats on Hold irrespective", "Livechat_AllowedDomainsList": "Livechat Allowed Domains", "Livechat_Appearance": "Livechat Appearance", "Livechat_auto_close_on_hold_chats_custom_message": "Custom message for closed chats in On Hold queue",