[RN] Fix pinParticipant if we are not yet in a conference
It may happen that such action is fired while joining.
This commit is contained in:
parent
b4d44f367d
commit
da0ae73d10
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue