fix(features): Allow checking features when jwt is not available. (#15906)

* fix(features): Allow checking features when jwt is not available.

Fixes #15904.

* squash: Drop unused import.
This commit is contained in:
Дамян Минков
2025-04-09 11:48:24 -05:00
committed by GitHub
parent 6e45643cce
commit 6903ccf009
4 changed files with 2 additions and 12 deletions

View File

@@ -89,12 +89,11 @@ export default function Toolbox({
const toolbarButtonsToUse = toolbarButtons || reduxToolbarButtons;
const chatOpen = useSelector((state: IReduxState) => state['features/chat'].isOpen);
const isDialogVisible = useSelector((state: IReduxState) => Boolean(state['features/base/dialog'].component));
const jwt = useSelector((state: IReduxState) => state['features/base/jwt'].jwt);
const localParticipant = useSelector(getLocalParticipant);
const transcribing = useSelector(isTranscribing);
// Do not convert to selector, it returns new array and will cause re-rendering of toolbox on every action.
const jwtDisabledButtons = getJwtDisabledButtons(transcribing, jwt, localParticipant?.features);
const jwtDisabledButtons = getJwtDisabledButtons(transcribing, localParticipant?.features);
const reactionsButtonEnabled = useSelector(isReactionsButtonEnabled);
const _shouldDisplayReactionsButtons = useSelector(shouldDisplayReactionsButtons);

View File

@@ -27,18 +27,15 @@ export function isAudioMuteButtonDisabled(state: IReduxState) {
* This function is stateless as it returns a new array and may cause re-rendering.
*
* @param {boolean} isTranscribing - Whether there is currently a transcriber in the meeting.
* @param {string | undefined} jwt - The jwt token.
* @param {ILocalParticipant} localParticipantFeatures - The features of the local participant.
* @returns {string[]} - The disabled by jwt buttons array.
*/
export function getJwtDisabledButtons(
isTranscribing: boolean,
jwt: string | undefined,
localParticipantFeatures?: IParticipantFeatures) {
const acc = [];
if (!isJwtFeatureEnabledStateless({
jwt,
localParticipantFeatures,
feature: 'livestreaming',
ifNotInFeatures: false
@@ -47,7 +44,6 @@ export function getJwtDisabledButtons(
}
if (!isTranscribing && !isJwtFeatureEnabledStateless({
jwt,
localParticipantFeatures,
feature: 'transcription',
ifNotInFeatures: false