Open source video conferencing app powered by LiveKit. Built with Django and React.
♻️(frontend) refactor permission updates to preserve admin privileges
lebaudantoineaeb5c3790c34
diff --git a/src/frontend/src/features/rooms/livekit/hooks/usePublishSourcesManager.ts b/src/frontend/src/features/rooms/livekit/hooks/usePublishSourcesManager.tsindex e14f70d0..71a1bfd1 100644--- a/src/frontend/src/features/rooms/livekit/hooks/usePublishSourcesManager.ts+++ b/src/frontend/src/features/rooms/livekit/hooks/usePublishSourcesManager.ts@@ -8,6 +8,7 @@ import { useRemoteParticipants } from '@livekit/components-react'import { useUpdateParticipantsPermissions } from '@/features/rooms/api/updateParticipantsPermissions'import { useRoomData } from '@/features/rooms/livekit/hooks/useRoomData'import { isSubsetOf } from '@/features/rooms/utils/isSubsetOf'+import { getParticipantIsRoomAdmin } from '@/features/rooms/utils/getParticipantIsRoomAdmin'import Source = Track.Sourceexport const updatePublishSources = (@@ -42,7 +43,9 @@ export const usePublishSourcesManager = () => {const { updateParticipantsPermissions } = useUpdateParticipantsPermissions()const remoteParticipants = useRemoteParticipants()- // todo - filter, update only contributors and not admin+ const unprivilegedRemoteParticipants = remoteParticipants.filter(+ (participant) => !getParticipantIsRoomAdmin(participant)+ )const currentSources = useMemo(() => {if (@@ -79,7 +82,10 @@ export const usePublishSourcesManager = () => {queryClient.setQueryData([keys.room, roomId], room)- await updateParticipantsPermissions(remoteParticipants, newSources)+ await updateParticipantsPermissions(+ unprivilegedRemoteParticipants,+ newSources+ )return { configuration: newConfiguration }} catch (error) {@@ -92,7 +98,7 @@ export const usePublishSourcesManager = () => {currentSources,roomId,patchRoom,- remoteParticipants,+ unprivilegedRemoteParticipants,updateParticipantsPermissions,])