* Prints errors in case of wrong initialization. Not printing can masks some errors in the code. * Allow only one Follow Me moderator in a meeting. * Sends Follow Me state with all presences of the moderator. This fixes an issue where the moderator sends the Follow Me state and then for example mute or unmute video (this will produce a presence without Follow Me state) and the new comers will not reflect current Follow Me state till a change of it comes. * Changes fixing comments. * Changes fixing comments.
34 lines
824 B
JavaScript
34 lines
824 B
JavaScript
// @flow
|
|
|
|
import {
|
|
SET_FOLLOW_ME_MODERATOR,
|
|
SET_FOLLOW_ME_STATE
|
|
} from './actionTypes';
|
|
import { ReducerRegistry, set } from '../base/redux';
|
|
|
|
/**
|
|
* Listen for actions that contain the Follow Me feature active state, so that it can be stored.
|
|
*/
|
|
ReducerRegistry.register(
|
|
'features/follow-me',
|
|
(state = {}, action) => {
|
|
switch (action.type) {
|
|
|
|
case SET_FOLLOW_ME_MODERATOR: {
|
|
let newState = set(state, 'moderator', action.id);
|
|
|
|
if (!action.id) {
|
|
// clear the state if feature becomes disabled
|
|
newState = set(newState, 'state', undefined);
|
|
}
|
|
|
|
return newState;
|
|
}
|
|
case SET_FOLLOW_ME_STATE: {
|
|
return set(state, 'state', action.state);
|
|
}
|
|
}
|
|
|
|
return state;
|
|
});
|