From 803184515f744da034611e8822d1c346500abed5 Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Tue, 10 Oct 2023 16:16:47 -0300 Subject: [PATCH] fix: incorrect over mac limit validation --- apps/meteor/client/hooks/omnichannel/useIsOverMacLimit.tsx | 5 ++--- .../ee/client/omnichannel/hooks/useOmnichannelHighlight.tsx | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/meteor/client/hooks/omnichannel/useIsOverMacLimit.tsx b/apps/meteor/client/hooks/omnichannel/useIsOverMacLimit.tsx index 5b455e9ac6e2..d1bb70f8107a 100644 --- a/apps/meteor/client/hooks/omnichannel/useIsOverMacLimit.tsx +++ b/apps/meteor/client/hooks/omnichannel/useIsOverMacLimit.tsx @@ -1,10 +1,9 @@ -import { useEndpoint, usePermission } from '@rocket.chat/ui-contexts'; +import { useEndpoint } from '@rocket.chat/ui-contexts'; import { useQuery } from '@tanstack/react-query'; export const useIsOverMacLimit = (): boolean => { const getMacLimit = useEndpoint('GET', '/v1/omnichannel/mac/check'); - const isLivechatManager = usePermission('view-livechat-manager'); - const { data: { onLimit = true } = {} } = useQuery(['/v1/omnichannel/mac/check'], () => getMacLimit(), { enabled: isLivechatManager }); + const { data: { onLimit = true } = {} } = useQuery(['/v1/omnichannel/mac/check'], () => getMacLimit()); return !onLimit; }; diff --git a/apps/meteor/ee/client/omnichannel/hooks/useOmnichannelHighlight.tsx b/apps/meteor/ee/client/omnichannel/hooks/useOmnichannelHighlight.tsx index 43601125e85c..d7bfb500d886 100644 --- a/apps/meteor/ee/client/omnichannel/hooks/useOmnichannelHighlight.tsx +++ b/apps/meteor/ee/client/omnichannel/hooks/useOmnichannelHighlight.tsx @@ -1,7 +1,10 @@ +import { usePermission } from '@rocket.chat/ui-contexts'; + import { useCurrentChatsHighlight } from './useCurrentChatsHighlight'; export const useOmnichannelHighlight = () => { + const isLivechatManager = usePermission('view-livechat-manager'); const { isHighlit } = useCurrentChatsHighlight(); - return { isHighlit }; + return { isHighlit: isLivechatManager && isHighlit }; };