Przeglądaj źródła

Associate remote participant w/ JitsiConference (_LEFT)

The commit message of "Associate remote participant w/ JitsiConference
(_JOINED)" explains the motivation for this commit.
j8
Lyubo Marinov 7 lat temu
rodzic
commit
37cd5bb5b9

+ 1
- 1
conference.js Wyświetl plik

@@ -1710,7 +1710,7 @@ export default {
1710 1710
             if (user.isHidden()) {
1711 1711
                 return;
1712 1712
             }
1713
-            APP.store.dispatch(participantLeft(id, user));
1713
+            APP.store.dispatch(participantLeft(id, room));
1714 1714
             logger.log('USER %s LEFT', id, user);
1715 1715
             APP.API.notifyUserLeft(id);
1716 1716
             APP.UI.removeUser(id, user.getDisplayName());

+ 1
- 1
modules/UI/shared_video/SharedVideo.js Wyświetl plik

@@ -517,7 +517,7 @@ export default class SharedVideoManager {
517 517
                     UIEvents.UPDATE_SHARED_VIDEO, null, 'removed');
518 518
             });
519 519
 
520
-        APP.store.dispatch(participantLeft(this.url));
520
+        APP.store.dispatch(participantLeft(this.url, APP.conference));
521 521
 
522 522
         this.url = null;
523 523
         this.isSharedVideoShown = false;

+ 1
- 1
react/features/base/conference/actions.js Wyświetl plik

@@ -147,7 +147,7 @@ function _addConferenceListeners(conference, dispatch) {
147 147
         })));
148 148
     conference.on(
149 149
         JitsiConferenceEvents.USER_LEFT,
150
-        (...args) => dispatch(participantLeft(...args)));
150
+        id => dispatch(participantLeft(id, conference)));
151 151
     conference.on(
152 152
         JitsiConferenceEvents.USER_ROLE_CHANGED,
153 153
         (...args) => dispatch(participantRoleChanged(...args)));

+ 20
- 2
react/features/base/participants/actions.js Wyświetl plik

@@ -123,7 +123,19 @@ export function localParticipantLeft() {
123 123
         const participant = getLocalParticipant(getState);
124 124
 
125 125
         if (participant) {
126
-            return dispatch(participantLeft(participant.id));
126
+            return (
127
+                dispatch(
128
+                    participantLeft(
129
+                        participant.id,
130
+
131
+                        // XXX Only the local participant is allowed to leave
132
+                        // without stating the JitsiConference instance because
133
+                        // the local participant is uniquely identified by the
134
+                        // very fact that there is only one local participant
135
+                        // (and the fact that the local participant "joins" at
136
+                        // the beginning of the app and "leaves" at the end of
137
+                        // the app).
138
+                        undefined)));
127 139
         }
128 140
     };
129 141
 }
@@ -234,17 +246,23 @@ export function participantJoined(participant) {
234 246
  * Action to signal that a participant has left.
235 247
  *
236 248
  * @param {string} id - Participant's ID.
249
+ * @param {JitsiConference} conference - The {@code JitsiConference} associated
250
+ * with the participant identified by the specified {@code id}. Only the local
251
+ * participant is allowed to not specify an associated {@code JitsiConference}
252
+ * instance.
237 253
  * @returns {{
238 254
  *     type: PARTICIPANT_LEFT,
239 255
  *     participant: {
256
+ *         conference: JitsiConference,
240 257
  *         id: string
241 258
  *     }
242 259
  * }}
243 260
  */
244
-export function participantLeft(id) {
261
+export function participantLeft(id, conference) {
245 262
     return {
246 263
         type: PARTICIPANT_LEFT,
247 264
         participant: {
265
+            conference,
248 266
             id
249 267
         }
250 268
     };

+ 14
- 2
react/features/base/participants/reducer.js Wyświetl plik

@@ -61,8 +61,20 @@ ReducerRegistry.register('features/base/participants', (state = [], action) => {
61 61
     case PARTICIPANT_JOINED:
62 62
         return [ ...state, _participantJoined(action) ];
63 63
 
64
-    case PARTICIPANT_LEFT:
65
-        return state.filter(p => p.id !== action.participant.id);
64
+    case PARTICIPANT_LEFT: {
65
+        // XXX A remote participant is uniquely identified by their id in a
66
+        // specific JitsiConference instance. The local participant is uniquely
67
+        // identified by the very fact that there is only one local participant
68
+        // (and the fact that the local participant "joins" at the beginning of
69
+        // the app and "leaves" at the end of the app).
70
+        const { conference, id } = action.participant;
71
+
72
+        return state.filter(p =>
73
+            !(
74
+                p.id === id
75
+                    && (p.local
76
+                        || (conference && p.conference === conference))));
77
+    }
66 78
     }
67 79
 
68 80
     return state;

Ładowanie…
Anuluj
Zapisz