Files
chat/client/shared/redux/hooks/useGroupMemberMute.ts

25 lines
621 B
TypeScript
Raw Permalink Normal View History

2026-04-25 16:36:34 +08:00
import { useAppSelector } from './useAppSelector';
/**
*
* @param groupId ID
* @param userId ID
* @returns false
*/
export function useGroupMemberMute(
groupId: string,
userId: string
): string | false {
const muteUntil = useAppSelector(
(state) =>
state.group.groups[groupId]?.members.find((m) => m.userId === userId)
?.muteUntil
);
if (!muteUntil || new Date(muteUntil).valueOf() < new Date().valueOf()) {
return false;
}
return muteUntil;
}