|
@@ -5,8 +5,11 @@ import { getConferenceState } from '../base/conference';
|
5
|
5
|
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
|
6
|
6
|
import { MEDIA_TYPE } from '../base/media';
|
7
|
7
|
import {
|
|
8
|
+ getLocalParticipant,
|
8
|
9
|
getParticipantDisplayName,
|
|
10
|
+ getRemoteParticipants,
|
9
|
11
|
isLocalParticipantModerator,
|
|
12
|
+ isParticipantModerator,
|
10
|
13
|
PARTICIPANT_UPDATED,
|
11
|
14
|
raiseHand
|
12
|
15
|
} from '../base/participants';
|
|
@@ -124,19 +127,29 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
124
|
127
|
case PARTICIPANT_UPDATED: {
|
125
|
128
|
const state = getState();
|
126
|
129
|
const audioModerationEnabled = isEnabledFromState(MEDIA_TYPE.AUDIO, state);
|
|
130
|
+ const participant = action.participant;
|
127
|
131
|
|
128
|
|
- // this is handled only by moderators
|
129
|
|
- if (audioModerationEnabled && isLocalParticipantModerator(state)) {
|
130
|
|
- const participant = action.participant;
|
|
132
|
+ if (participant && audioModerationEnabled) {
|
|
133
|
+ if (isLocalParticipantModerator(state)) {
|
131
|
134
|
|
132
|
|
- if (participant.raisedHand) {
|
133
|
|
- // if participant raises hand show notification
|
134
|
|
- !isParticipantApproved(participant.id, MEDIA_TYPE.AUDIO)(state)
|
|
135
|
+ // this is handled only by moderators
|
|
136
|
+ if (participant.raisedHand) {
|
|
137
|
+ // if participant raises hand show notification
|
|
138
|
+ !isParticipantApproved(participant.id, MEDIA_TYPE.AUDIO)(state)
|
135
|
139
|
&& dispatch(participantPendingAudio(participant));
|
136
|
|
- } else {
|
137
|
|
- // if participant lowers hand hide notification
|
138
|
|
- isParticipantPending(participant, MEDIA_TYPE.AUDIO)(state)
|
|
140
|
+ } else {
|
|
141
|
+ // if participant lowers hand hide notification
|
|
142
|
+ isParticipantPending(participant, MEDIA_TYPE.AUDIO)(state)
|
139
|
143
|
&& dispatch(dismissPendingAudioParticipant(participant));
|
|
144
|
+ }
|
|
145
|
+ } else if (participant.id === getLocalParticipant(state).id
|
|
146
|
+ && /* the new role */ isParticipantModerator(participant)) {
|
|
147
|
+
|
|
148
|
+ // this is the granted moderator case
|
|
149
|
+ getRemoteParticipants(state).forEach(p => {
|
|
150
|
+ p.raisedHand && !isParticipantApproved(p.id, MEDIA_TYPE.AUDIO)(state)
|
|
151
|
+ && dispatch(participantPendingAudio(p));
|
|
152
|
+ });
|
140
|
153
|
}
|
141
|
154
|
}
|
142
|
155
|
|