fix(features/notifications): crash on undefined participant

This commit is contained in:
paweldomas 2020-03-19 12:40:36 -05:00 committed by Дамян Минков
parent c40a7f736e
commit 14855f3255
1 changed files with 3 additions and 2 deletions

View File

@ -84,9 +84,10 @@ MiddlewareRegistry.register(store => next => action => {
const { id, role } = action.participant; const { id, role } = action.participant;
const state = store.getState(); const state = store.getState();
const { role: oldRole } = getParticipantById(state, id); const oldParticipant = getParticipantById(state, id);
const oldRole = oldParticipant?.role;
if (oldRole !== role && role === PARTICIPANT_ROLE.MODERATOR) { if (oldRole && oldRole !== role && role === PARTICIPANT_ROLE.MODERATOR) {
const displayName = getParticipantDisplayName(state, id); const displayName = getParticipantDisplayName(state, id);
store.dispatch(showNotification({ store.dispatch(showNotification({