From 13f76c2cce845e79cb69a8492d92bb946614c611 Mon Sep 17 00:00:00 2001 From: Hristo Terezov Date: Thu, 30 Apr 2020 16:25:34 -0500 Subject: [PATCH] fix(follow-me): disable the auto pin on SS --- react/features/follow-me/functions.js | 16 ++++++++++++++++ react/features/follow-me/index.js | 1 + react/features/follow-me/middleware.js | 3 ++- react/features/settings/functions.js | 3 ++- react/features/video-layout/subscriber.js | 7 ++++--- 5 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 react/features/follow-me/functions.js diff --git a/react/features/follow-me/functions.js b/react/features/follow-me/functions.js new file mode 100644 index 000000000..ca23a87e3 --- /dev/null +++ b/react/features/follow-me/functions.js @@ -0,0 +1,16 @@ +// @flow + +import { toState } from '../base/redux'; + +/** + * Returns true if follow me is active and false otherwise. + * + * @param {Object|Function} stateful - Object or function that can be resolved + * to the Redux state. + * @returns {boolean} - True if follow me is active and false otherwise. + */ +export function isFollowMeActive(stateful: Object | Function) { + const state = toState(stateful); + + return Boolean(state['features/follow-me'].moderator); +} diff --git a/react/features/follow-me/index.js b/react/features/follow-me/index.js index fc45b694e..024c757ad 100644 --- a/react/features/follow-me/index.js +++ b/react/features/follow-me/index.js @@ -1,3 +1,4 @@ +export * from './functions'; export * from './middleware'; export * from './subscriber'; diff --git a/react/features/follow-me/middleware.js b/react/features/follow-me/middleware.js index 609de881f..540bba307 100644 --- a/react/features/follow-me/middleware.js +++ b/react/features/follow-me/middleware.js @@ -16,6 +16,7 @@ import { setFilmstripVisible } from '../filmstrip'; import { setTileView } from '../video-layout'; import { FOLLOW_ME_COMMAND } from './constants'; +import { isFollowMeActive } from './functions'; import logger from './logger'; declare var APP: Object; @@ -111,7 +112,7 @@ function _onFollowMeCommand(attributes = {}, id, store) { return; } - if (!state['features/follow-me'].moderator) { + if (!isFollowMeActive(state)) { store.dispatch(setFollowMeModerator(id)); } diff --git a/react/features/settings/functions.js b/react/features/settings/functions.js index 40fe09af5..4bd3a66af 100644 --- a/react/features/settings/functions.js +++ b/react/features/settings/functions.js @@ -7,6 +7,7 @@ import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants'; +import { isFollowMeActive } from '../follow-me'; declare var interfaceConfig: Object; @@ -85,7 +86,7 @@ export function getMoreTabProps(stateful: Object | Function) { startAudioMutedPolicy, startVideoMutedPolicy } = state['features/base/conference']; - const followMeActive = Boolean(state['features/follow-me'].moderator); + const followMeActive = isFollowMeActive(state); const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || []; // The settings sections to display. diff --git a/react/features/video-layout/subscriber.js b/react/features/video-layout/subscriber.js index d80ab6469..a4c7a9a57 100644 --- a/react/features/video-layout/subscriber.js +++ b/react/features/video-layout/subscriber.js @@ -11,7 +11,9 @@ import { pinParticipant } from '../base/participants'; import { StateListenerRegistry, equals } from '../base/redux'; +import { isFollowMeActive } from '../follow-me'; import { selectParticipant } from '../large-video'; + import { shouldDisplayTileView } from './functions'; import { setParticipantsWithScreenShare } from './actions'; @@ -48,12 +50,11 @@ StateListenerRegistry.register( StateListenerRegistry.register( /* selector */ state => state['features/base/tracks'], /* listener */ debounce((tracks, store) => { - if (!_getAutoPinSetting()) { + if (!_getAutoPinSetting() || isFollowMeActive(store)) { return; } - const oldScreenSharesOrder - = store.getState()['features/video-layout'].screenShares || []; + const oldScreenSharesOrder = store.getState()['features/video-layout'].screenShares || []; const knownSharingParticipantIds = tracks.reduce((acc, track) => { if (track.mediaType === 'video' && track.videoType === 'desktop') { const skipTrack = _getAutoPinSetting() === 'remote-only' && track.local;