Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

Saúl Ibarra Corretgéda0ae73d1065
diff --git a/react/features/base/conference/middleware.js b/react/features/base/conference/middleware.js
index 5c8cba0525..934b15b581 100644
--- a/react/features/base/conference/middleware.js
+++ b/react/features/base/conference/middleware.js
@@ -185,26 +185,29 @@ function _conferenceJoined(store, next, action) {
function _pinParticipant(store, next, action) {
const state = store.getState();
const { conference } = state['features/base/conference'];
+
+ if (!conference) {
+ return next(action);
+ }
+
const participants = state['features/base/participants'];
const id = action.participant.id;
const participantById = getParticipantById(participants, id);
- let pin;
if (typeof APP !== 'undefined') {
const pinnedParticipant = getPinnedParticipant(participants);
- const actionName
- = action.participant.id ? ACTION_PINNED : ACTION_UNPINNED;
- const local = (participantById && participantById.local)
+ const actionName = id ? ACTION_PINNED : ACTION_UNPINNED;
+ const local
+ = (participantById && participantById.local)
|| (!id && pinnedParticipant && pinnedParticipant.local);
sendAnalytics(createPinnedEvent(
actionName,
local ? 'local' : id,
{
- 'participant_count': conference.getParticipantCount(),
- local
+ local,
+ 'participant_count': conference.getParticipantCount()
}));
-
}
// The following condition prevents signaling to pin local participant and
@@ -214,6 +217,8 @@ function _pinParticipant(store, next, action) {
// - If we don't have an ID (i.e. no participant identified by an ID), we
// check for local participant. If she's currently pinned, then this
// action will unpin her and that's why we won't signal here too.
+ let pin;
+
if (participantById) {
pin = !participantById.local && !participantById.isBot;
} else {
@@ -222,7 +227,6 @@ function _pinParticipant(store, next, action) {
pin = !localParticipant || !localParticipant.pinned;
}
if (pin) {
-
try {
conference.pinParticipant(id);
} catch (err) {