fix: allowModsToUnmuteUsers param not working (#20888)

* fix unmute user feature
This commit is contained in:
Ramón Souza 2024-08-15 11:10:08 -03:00 committed by GitHub
parent 39dba53dec
commit 23e8e01871
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -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,

View File

@ -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