Parcourir la source

fix: Process pre-existing participants properties.

We were not processing properties which are set (fire properties updated) before the conference joined event is fired.
master
damencho il y a 4 ans
Parent
révision
28fa1f5dbe
1 fichiers modifiés avec 42 ajouts et 40 suppressions
  1. 42
    40
      react/features/base/participants/middleware.js

+ 42
- 40
react/features/base/participants/middleware.js Voir le fichier

206
     state => state['features/base/conference'].conference,
206
     state => state['features/base/conference'].conference,
207
     (conference, store) => {
207
     (conference, store) => {
208
         if (conference) {
208
         if (conference) {
209
+            const propertyHandlers = {
210
+                'e2eeEnabled': (participant, value) => _e2eeUpdated(store, conference, participant.getId(), value),
211
+                'features_e2ee': (participant, value) =>
212
+                    store.dispatch(participantUpdated({
213
+                        conference,
214
+                        id: participant.getId(),
215
+                        e2eeSupported: value
216
+                    })),
217
+                'features_jigasi': (participant, value) =>
218
+                    store.dispatch(participantUpdated({
219
+                        conference,
220
+                        id: participant.getId(),
221
+                        isJigasi: value
222
+                    })),
223
+                'features_screen-sharing': (participant, value) => // eslint-disable-line no-unused-vars
224
+                    store.dispatch(participantUpdated({
225
+                        conference,
226
+                        id: participant.getId(),
227
+                        features: { 'screen-sharing': true }
228
+                    })),
229
+                'raisedHand': (participant, value) => _raiseHandUpdated(store, conference, participant.getId(), value),
230
+                'remoteControlSessionStatus': (participant, value) =>
231
+                    store.dispatch(participantUpdated({
232
+                        conference,
233
+                        id: participant.getId(),
234
+                        remoteControlSessionStatus: value
235
+                    }))
236
+            };
237
+
238
+            // update properties for the participants that are already in the conference
239
+            conference.getParticipants().forEach(participant => {
240
+                Object.keys(propertyHandlers).forEach(propertyName => {
241
+                    const value = participant.getProperty(propertyName);
242
+
243
+                    if (value !== undefined) {
244
+                        propertyHandlers[propertyName](participant, value);
245
+                    }
246
+                });
247
+            });
248
+
209
             // We joined a conference
249
             // We joined a conference
210
             conference.on(
250
             conference.on(
211
                 JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
251
                 JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
212
                 (participant, propertyName, oldValue, newValue) => {
252
                 (participant, propertyName, oldValue, newValue) => {
213
-                    switch (propertyName) {
214
-                    case 'e2eeEnabled':
215
-                        _e2eeUpdated(store, conference, participant.getId(), newValue);
216
-                        break;
217
-                    case 'features_e2ee':
218
-                        store.dispatch(participantUpdated({
219
-                            conference,
220
-                            id: participant.getId(),
221
-                            e2eeSupported: newValue
222
-                        }));
223
-                        break;
224
-                    case 'features_jigasi':
225
-                        store.dispatch(participantUpdated({
226
-                            conference,
227
-                            id: participant.getId(),
228
-                            isJigasi: newValue
229
-                        }));
230
-                        break;
231
-                    case 'features_screen-sharing':
232
-                        store.dispatch(participantUpdated({
233
-                            conference,
234
-                            id: participant.getId(),
235
-                            features: { 'screen-sharing': true }
236
-                        }));
237
-                        break;
238
-                    case 'raisedHand': {
239
-                        _raiseHandUpdated(store, conference, participant.getId(), newValue);
240
-                        break;
241
-                    }
242
-                    case 'remoteControlSessionStatus':
243
-                        store.dispatch(participantUpdated({
244
-                            conference,
245
-                            id: participant.getId(),
246
-                            remoteControlSessionStatus: newValue
247
-                        }));
248
-                        break;
249
-                    default:
250
-
251
-                        // Ignore for now.
253
+                    if (propertyHandlers.hasOwnProperty(propertyName)) {
254
+                        propertyHandlers[propertyName](participant, newValue);
252
                     }
255
                     }
253
-
254
                 });
256
                 });
255
         } else {
257
         } else {
256
             const localParticipantId = getLocalParticipant(store.getState).id;
258
             const localParticipantId = getLocalParticipant(store.getState).id;

Chargement…
Annuler
Enregistrer