Skip to content

Commit

Permalink
fix(jwt): Fixes when feature is missing from features.
Browse files Browse the repository at this point in the history
By default, that feature is disabled.
  • Loading branch information
damencho committed Oct 1, 2024
1 parent 8d5d3f0 commit 15579c3
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion react/features/base/jwt/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function isJwtFeatureEnabledStateless({
}

if (typeof features === 'undefined') {
return ifNotInFeatures;
return ifNoToken;
}

if (typeof features[feature as keyof typeof features] === 'undefined') {
Expand Down
4 changes: 2 additions & 2 deletions react/features/invite/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export function isDialOutEnabled(state: IReduxState): boolean {
const { conference } = state['features/base/conference'];
const isModerator = isLocalParticipantModerator(state);

return isJwtFeatureEnabled(state, 'outbound-call', isModerator, isModerator)
return isJwtFeatureEnabled(state, 'outbound-call', isModerator, false)
&& conference && conference.isSIPCallingSupported();
}

Expand All @@ -507,7 +507,7 @@ export function isSipInviteEnabled(state: IReduxState): boolean {
const { sipInviteUrl } = state['features/base/config'];
const isModerator = isLocalParticipantModerator(state);

return isJwtFeatureEnabled(state, 'sip-outbound-call', isModerator, isModerator)
return isJwtFeatureEnabled(state, 'sip-outbound-call', isModerator, false)
&& Boolean(sipInviteUrl);
}

Expand Down
2 changes: 1 addition & 1 deletion react/features/recording/actions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export function showStartRecordingNotificationWithCallback(openRecordingDialog:
const isModerator = isLocalParticipantModerator(state);
const { recordingService } = state['features/base/config'];
const canBypassDialog = recordingService?.enabled
&& isJwtFeatureEnabled(state, 'recording', isModerator, isModerator);
&& isJwtFeatureEnabled(state, 'recording', isModerator, false);

if (canBypassDialog) {
const options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function _mapStateToProps(state: IReduxState, ownProps: IProps) {
const liveStreaming = getLiveStreaming(state);

visible = isLiveStreamingButtonVisible({
liveStreamingAllowed: isJwtFeatureEnabled(state, 'livestreaming', isModerator, isModerator),
liveStreamingAllowed: isJwtFeatureEnabled(state, 'livestreaming', isModerator, false),
liveStreamingEnabled: liveStreaming?.enabled,
isInBreakoutRoom: isInBreakoutRoom(state)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ export function mapStateToProps(state: IReduxState) {
isVpaas: isVpaasMeeting(state),
_canStartTranscribing: canAddTranscriber(state),
_hideStorageWarning: Boolean(recordingService?.hideStorageWarning),
_renderRecording: isJwtFeatureEnabled(state, 'recording', isModerator, isModerator),
_renderRecording: isJwtFeatureEnabled(state, 'recording', isModerator, false),
_localRecordingAvailable,
_localRecordingEnabled: !localRecording?.disable,
_localRecordingSelfEnabled: !localRecording?.disableSelfRecording,
Expand Down
4 changes: 2 additions & 2 deletions react/features/recording/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export function canStopRecording(state: IReduxState) {
if (isCloudRecordingRunning(state) || isRecorderTranscriptionsRunning(state)) {
const isModerator = isLocalParticipantModerator(state);

return isJwtFeatureEnabled(state, 'recording', isModerator, isModerator);
return isJwtFeatureEnabled(state, 'recording', isModerator, false);
}

return false;
Expand Down Expand Up @@ -269,7 +269,7 @@ export function getRecordButtonProps(state: IReduxState) {

if (localRecordingEnabled) {
visible = true;
} else if (isJwtFeatureEnabled(state, 'recording', isModerator, isModerator)) {
} else if (isJwtFeatureEnabled(state, 'recording', isModerator, false)) {
visible = recordingEnabled;
}

Expand Down
2 changes: 1 addition & 1 deletion react/features/recording/hooks.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function useLiveStreamingButton() {
const localParticipantIsModerator = useSelector(isLocalParticipantModerator);
const liveStreaming = useSelector(getLiveStreaming);
const liveStreamingAllowed = useSelector((state: IReduxState) =>
isJwtFeatureEnabled(state, 'livestreaming', localParticipantIsModerator, localParticipantIsModerator));
isJwtFeatureEnabled(state, 'livestreaming', localParticipantIsModerator, false));
const _isInBreakoutRoom = useSelector(isInBreakoutRoom);

if (toolbarButtons?.includes('recording')
Expand Down
2 changes: 1 addition & 1 deletion react/features/subtitles/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function _requestingSubtitlesChange(

if (enabled && conference?.getTranscriptionStatus() === JitsiMeetJS.constants.transcriptionStatus.OFF) {
const isModerator = isLocalParticipantModerator(state);
const featureAllowed = isJwtFeatureEnabled(getState(), 'transcription', isModerator, isModerator);
const featureAllowed = isJwtFeatureEnabled(getState(), 'transcription', isModerator, false);

if (featureAllowed) {
conference?.dial(TRANSCRIBER_DIAL_NUMBER)
Expand Down
4 changes: 2 additions & 2 deletions react/features/toolbox/functions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function getJwtDisabledButtons(
localParticipantFeatures,
feature: 'livestreaming',
ifNoToken: isModerator,
ifNotInFeatures: isModerator
ifNotInFeatures: false
})) {
acc.push('livestreaming');
}
Expand All @@ -48,7 +48,7 @@ export function getJwtDisabledButtons(
localParticipantFeatures,
feature: 'transcription',
ifNoToken: isModerator,
ifNotInFeatures: isModerator
ifNotInFeatures: false
})) {
acc.push('closedcaptions');
}
Expand Down
2 changes: 1 addition & 1 deletion react/features/transcribing/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function isRecorderTranscriptionsRunning(state: IReduxState) {
export function canAddTranscriber(state: IReduxState) {
const { transcription } = state['features/base/config'];
const isModerator = isLocalParticipantModerator(state);
const isTranscribingAllowed = isJwtFeatureEnabled(state, 'transcription', isModerator, isModerator);
const isTranscribingAllowed = isJwtFeatureEnabled(state, 'transcription', isModerator, false);

return Boolean(transcription?.enabled) && isTranscribingAllowed;
}

0 comments on commit 15579c3

Please sign in to comment.