Skip to content

Commit

Permalink
fix: ignore closed room for mac validations
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva committed Oct 23, 2023
1 parent a9f4d51 commit ce3bf76
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const getPeriod = (date: Date) => `${date.getFullYear()}-${String(date.getMonth(

export const useIsRoomOverMacLimit = (room: IRoom) => {
const isOverMacLimit = useIsOverMacLimit();
const { v: { activity = [] } = {}, t: roomType } = room as IOmnichannelGenericRoom;
const { v: { activity = [] } = {}, t: roomType, open } = room as IOmnichannelGenericRoom;

const isContactActive = useMemo(() => {
if (!['l', 'v'].includes(roomType)) {
if (!['l', 'v'].includes(roomType) || !open) {
return true;
}

const currentPeriod = getPeriod(new Date());
return !isOverMacLimit || activity.includes(currentPeriod);
}, [activity, isOverMacLimit, roomType]);
}, [activity, isOverMacLimit, open, roomType]);

return !isContactActive;
};

0 comments on commit ce3bf76

Please sign in to comment.