瀏覽代碼

[RN] Fix pinParticipant if we are not yet in a conference

It may happen that such action is fired while joining.
master
Saúl Ibarra Corretgé 7 年之前
父節點
當前提交
da0ae73d10
共有 1 個文件被更改,包括 12 次插入8 次删除
  1. 12
    8
      react/features/base/conference/middleware.js

+ 12
- 8
react/features/base/conference/middleware.js 查看文件

185
 function _pinParticipant(store, next, action) {
185
 function _pinParticipant(store, next, action) {
186
     const state = store.getState();
186
     const state = store.getState();
187
     const { conference } = state['features/base/conference'];
187
     const { conference } = state['features/base/conference'];
188
+
189
+    if (!conference) {
190
+        return next(action);
191
+    }
192
+
188
     const participants = state['features/base/participants'];
193
     const participants = state['features/base/participants'];
189
     const id = action.participant.id;
194
     const id = action.participant.id;
190
     const participantById = getParticipantById(participants, id);
195
     const participantById = getParticipantById(participants, id);
191
-    let pin;
192
 
196
 
193
     if (typeof APP !== 'undefined') {
197
     if (typeof APP !== 'undefined') {
194
         const pinnedParticipant = getPinnedParticipant(participants);
198
         const pinnedParticipant = getPinnedParticipant(participants);
195
-        const actionName
196
-            = action.participant.id ? ACTION_PINNED : ACTION_UNPINNED;
197
-        const local = (participantById && participantById.local)
199
+        const actionName = id ? ACTION_PINNED : ACTION_UNPINNED;
200
+        const local
201
+            = (participantById && participantById.local)
198
                 || (!id && pinnedParticipant && pinnedParticipant.local);
202
                 || (!id && pinnedParticipant && pinnedParticipant.local);
199
 
203
 
200
         sendAnalytics(createPinnedEvent(
204
         sendAnalytics(createPinnedEvent(
201
             actionName,
205
             actionName,
202
             local ? 'local' : id,
206
             local ? 'local' : id,
203
             {
207
             {
204
-                'participant_count': conference.getParticipantCount(),
205
-                local
208
+                local,
209
+                'participant_count': conference.getParticipantCount()
206
             }));
210
             }));
207
-
208
     }
211
     }
209
 
212
 
210
     // The following condition prevents signaling to pin local participant and
213
     // The following condition prevents signaling to pin local participant and
214
     // - If we don't have an ID (i.e. no participant identified by an ID), we
217
     // - If we don't have an ID (i.e. no participant identified by an ID), we
215
     //   check for local participant. If she's currently pinned, then this
218
     //   check for local participant. If she's currently pinned, then this
216
     //   action will unpin her and that's why we won't signal here too.
219
     //   action will unpin her and that's why we won't signal here too.
220
+    let pin;
221
+
217
     if (participantById) {
222
     if (participantById) {
218
         pin = !participantById.local && !participantById.isBot;
223
         pin = !participantById.local && !participantById.isBot;
219
     } else {
224
     } else {
222
         pin = !localParticipant || !localParticipant.pinned;
227
         pin = !localParticipant || !localParticipant.pinned;
223
     }
228
     }
224
     if (pin) {
229
     if (pin) {
225
-
226
         try {
230
         try {
227
             conference.pinParticipant(id);
231
             conference.pinParticipant(id);
228
         } catch (err) {
232
         } catch (err) {

Loading…
取消
儲存