Skip to content

Commit

Permalink
fix: incorrect over mac limit validation
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva committed Oct 10, 2023
1 parent 1f1b314 commit 8031845
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions apps/meteor/client/hooks/omnichannel/useIsOverMacLimit.tsx
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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 };
};

0 comments on commit 8031845

Please sign in to comment.