Skip to content

Commit

Permalink
fix(jwt): Fixes getJwtDisabledButtons to respect moderator flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Oct 1, 2024
1 parent d1d77c8 commit 8d5d3f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion react/features/toolbox/components/web/Toolbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function Toolbox({
const jwt = useSelector((state: IReduxState) => state['features/base/jwt'].jwt);
const localParticipant = useSelector(getLocalParticipant);
const jwtDisabledButtons = useSelector((state: IReduxState) =>
getJwtDisabledButtons(state, jwt, localParticipant?.features));
getJwtDisabledButtons(state, isModerator, jwt, localParticipant?.features));
const reactionsButtonEnabled = useSelector(isReactionsButtonEnabled);
const _shouldDisplayReactionsButtons = useSelector(shouldDisplayReactionsButtons);
const toolbarVisible = useSelector(isToolboxVisible);
Expand Down
10 changes: 6 additions & 4 deletions react/features/toolbox/functions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ export function isAudioMuteButtonDisabled(state: IReduxState) {
* Returns the buttons corresponding to features disabled through jwt.
*
* @param {IReduxState} state - The state from the Redux store.
* @param {boolean} isModerator - Whether local participant is moderator.
* @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(
state: IReduxState,
isModerator: boolean,
jwt: string | undefined,
localParticipantFeatures?: IParticipantFeatures) {
const acc = [];
Expand All @@ -35,8 +37,8 @@ export function getJwtDisabledButtons(
jwt,
localParticipantFeatures,
feature: 'livestreaming',
ifNoToken: true,
ifNotInFeatures: true
ifNoToken: isModerator,
ifNotInFeatures: isModerator
})) {
acc.push('livestreaming');
}
Expand All @@ -45,8 +47,8 @@ export function getJwtDisabledButtons(
jwt,
localParticipantFeatures,
feature: 'transcription',
ifNoToken: true,
ifNotInFeatures: true
ifNoToken: isModerator,
ifNotInFeatures: isModerator
})) {
acc.push('closedcaptions');
}
Expand Down

0 comments on commit 8d5d3f0

Please sign in to comment.