Skip to content
Snippets Groups Projects
Commit a73f5ec7 authored by Anton Georgiev's avatar Anton Georgiev
Browse files

send muted boolean on user (un)mute

parent b8684d74
No related branches found
No related tags found
No related merge requests found
......@@ -18,12 +18,7 @@ export default function muteToggle(credentials, userId) {
check(meetingId, String);
check(requesterUserId, String);
const payload = {
userId,
mutedBy: requesterUserId,
};
const user = Users.findOne({
const requester = Users.findOne({
meetingId,
userId: requesterUserId,
});
......@@ -32,20 +27,25 @@ export default function muteToggle(credentials, userId) {
intId: userId,
});
if (!user || !voiceUser) return;
const isListenOnly = voiceUser.listenOnly;
if (!requester || !voiceUser) return;
if (isListenOnly) return;
const { listenOnly, muted } = voiceUser;
if (listenOnly) return;
const isModerator = user.roles.includes(ROLE_MODERATOR.toLowerCase());
const isMuted = voiceUser.muted;
const isModerator = requester.roles.includes(ROLE_MODERATOR.toLowerCase());
const isNotHimself = requesterUserId !== userId;
// the ability for a moderator to unmute other users is configurable (on/off)
if (!ALLOW_MODERATOR_TO_UNMUTE_AUDIO &&
isModerator &&
isMuted &&
muted &&
isNotHimself) return;
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
const payload = {
userId,
mutedBy: requesterUserId,
mute: !muted,
};
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment