fix: allowModsToUnmuteUsers param not working (#20888)
* fix unmute user feature
This commit is contained in:
parent
39dba53dec
commit
23e8e01871
@ -39,6 +39,7 @@ import { useMutation, useLazyQuery } from '@apollo/client';
|
||||
import { CURRENT_PAGE_WRITERS_QUERY } from '/imports/ui/components/whiteboard/queries';
|
||||
import { PRESENTATION_SET_WRITERS } from '/imports/ui/components/presentation/mutations';
|
||||
import useToggleVoice from '/imports/ui/components/audio/audio-graphql/hooks/useToggleVoice';
|
||||
import useWhoIsUnmuted from '/imports/ui/core/hooks/useWhoIsUnmuted';
|
||||
|
||||
interface UserActionsProps {
|
||||
user: User;
|
||||
@ -242,12 +243,17 @@ const UserActions: React.FC<UserActionsProps> = ({
|
||||
};
|
||||
|
||||
const { pluginsExtensibleAreasAggregatedState } = useContext(PluginsContext);
|
||||
|
||||
const { data: unmutedUsers } = useWhoIsUnmuted();
|
||||
const isMuted = !unmutedUsers[user.userId];
|
||||
|
||||
const actionsnPermitions = generateActionsPermissions(
|
||||
user,
|
||||
currentUser,
|
||||
lockSettings,
|
||||
usersPolicies,
|
||||
isBreakout,
|
||||
isMuted,
|
||||
);
|
||||
const {
|
||||
allowedToChatPrivately,
|
||||
|
@ -17,6 +17,7 @@ export const generateActionsPermissions = (
|
||||
lockSettings: LockSettings,
|
||||
usersPolicies: UsersPolicies,
|
||||
isBreakout: boolean,
|
||||
isMuted: boolean,
|
||||
) => {
|
||||
const subjectUserVoice = subjectUser.voice;
|
||||
|
||||
@ -29,13 +30,13 @@ export const generateActionsPermissions = (
|
||||
const allowedToChatPrivately = !amISubjectUser && !isDialInUser;
|
||||
const allowedToMuteAudio = hasAuthority
|
||||
&& subjectUserVoice?.joined
|
||||
&& !subjectUserVoice?.muted
|
||||
&& !isMuted
|
||||
&& !subjectUserVoice?.listenOnly;
|
||||
|
||||
const allowedToUnmuteAudio = hasAuthority
|
||||
&& subjectUserVoice?.joined
|
||||
&& !subjectUserVoice.listenOnly
|
||||
&& subjectUserVoice.muted
|
||||
&& isMuted
|
||||
&& (amISubjectUser || usersPolicies?.allowModsToUnmuteUsers);
|
||||
|
||||
// if currentUser is a moderator, allow removing other users
|
||||
|
Loading…
Reference in New Issue
Block a user