From fc694641dc46f89e95faaf8f8062596a132d9b1e Mon Sep 17 00:00:00 2001 From: Jaya Allamsetty Date: Thu, 19 Nov 2020 16:34:28 -0500 Subject: [PATCH] fix(lastN): Do not override channelLastN value. If limitLastN values are specified and channelLastN < limitLastN, configure channelLastN on the conference. --- react/features/base/lastn/middleware.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/react/features/base/lastn/middleware.js b/react/features/base/lastn/middleware.js index 4b0916b9c..e746983a1 100644 --- a/react/features/base/lastn/middleware.js +++ b/react/features/base/lastn/middleware.js @@ -68,14 +68,13 @@ function _updateLastN({ getState }) { return; } - const defaultLastN = typeof config.channelLastN === 'undefined' ? -1 : config.channelLastN; - let lastN = defaultLastN; + let lastN = typeof config.channelLastN === 'undefined' ? -1 : config.channelLastN; - // Apply last N limit based on the # of participants + // Apply last N limit based on the # of participants and channelLastN settings. const limitedLastN = limitLastN(participantCount, lastNLimits); if (limitedLastN !== undefined) { - lastN = limitedLastN; + lastN = lastN === -1 ? limitedLastN : Math.min(limitedLastN, lastN); } if (typeof appState !== 'undefined' && appState !== 'active') {