瀏覽代碼

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 年之前
父節點
當前提交
37cd5bb5b9

+ 1
- 1
conference.js 查看文件

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

+ 1
- 1
modules/UI/shared_video/SharedVideo.js 查看文件

517
                     UIEvents.UPDATE_SHARED_VIDEO, null, 'removed');
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
         this.url = null;
522
         this.url = null;
523
         this.isSharedVideoShown = false;
523
         this.isSharedVideoShown = false;

+ 1
- 1
react/features/base/conference/actions.js 查看文件

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

+ 20
- 2
react/features/base/participants/actions.js 查看文件

123
         const participant = getLocalParticipant(getState);
123
         const participant = getLocalParticipant(getState);
124
 
124
 
125
         if (participant) {
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
  * Action to signal that a participant has left.
246
  * Action to signal that a participant has left.
235
  *
247
  *
236
  * @param {string} id - Participant's ID.
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
  * @returns {{
253
  * @returns {{
238
  *     type: PARTICIPANT_LEFT,
254
  *     type: PARTICIPANT_LEFT,
239
  *     participant: {
255
  *     participant: {
256
+ *         conference: JitsiConference,
240
  *         id: string
257
  *         id: string
241
  *     }
258
  *     }
242
  * }}
259
  * }}
243
  */
260
  */
244
-export function participantLeft(id) {
261
+export function participantLeft(id, conference) {
245
     return {
262
     return {
246
         type: PARTICIPANT_LEFT,
263
         type: PARTICIPANT_LEFT,
247
         participant: {
264
         participant: {
265
+            conference,
248
             id
266
             id
249
         }
267
         }
250
     };
268
     };

+ 14
- 2
react/features/base/participants/reducer.js 查看文件

61
     case PARTICIPANT_JOINED:
61
     case PARTICIPANT_JOINED:
62
         return [ ...state, _participantJoined(action) ];
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
     return state;
80
     return state;

Loading…
取消
儲存