diff --git a/config.js b/config.js index 48145233ef..f908a04328 100644 --- a/config.js +++ b/config.js @@ -1607,6 +1607,8 @@ var config = { // audio: true, // video: true // }, + // // Hides the visitor count for visitors. + // // hideVisitorCountForVisitors: false, // }, // The default type of desktop sharing sources that will be used in the electron app. // desktopSharingSources: ['screen', 'window'], diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts index faa2d1da7c..18918509f8 100644 --- a/react/features/base/config/configType.ts +++ b/react/features/base/config/configType.ts @@ -654,6 +654,7 @@ export interface IConfig { audio?: boolean; video?: boolean; }; + hideVisitorCountForVisitors?: boolean; queueService: string; }; watchRTCConfigParams?: IWatchRTCConfiguration; diff --git a/react/features/base/config/configWhitelist.ts b/react/features/base/config/configWhitelist.ts index bb7bdd0a90..72a2210748 100644 --- a/react/features/base/config/configWhitelist.ts +++ b/react/features/base/config/configWhitelist.ts @@ -238,6 +238,7 @@ export default [ 'useTurnUdp', 'videoQuality', 'visitors.enableMediaOnPromote', + 'visitors.hideVisitorCountForVisitors', 'watchRTCConfigParams.allowBrowserLogCollection', 'watchRTCConfigParams.collectionInterval', 'watchRTCConfigParams.console', diff --git a/react/features/visitors/functions.ts b/react/features/visitors/functions.ts index 0369449d68..8ef9ff180b 100644 --- a/react/features/visitors/functions.ts +++ b/react/features/visitors/functions.ts @@ -45,7 +45,15 @@ export function iAmVisitor(stateful: IStateful) { * @returns {number} - The number of visitors. */ export function getVisitorsCount(stateful: IStateful) { - return toState(stateful)['features/visitors'].count ?? 0; + const state = toState(stateful); + const { hideVisitorCountForVisitors } = state['features/base/config'].visitors || {}; + const isVisitor = state['features/visitors'].iAmVisitor; + + if (isVisitor && hideVisitorCountForVisitors) { + return 0; + } + + return state['features/visitors'].count ?? 0; } /**