Skip to content

Commit

Permalink
squash: Reverting back isLiveStreamingButtonVisible.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Sep 12, 2024
1 parent 708d1d2 commit d00219c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/too
import { isInBreakoutRoom } from '../../../breakout-rooms/functions';
import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';
import { isRecorderTranscriptionsRunning } from '../../../transcribing/functions';
import { isCloudRecordingRunning, isLiveStreamingRunning } from '../../functions';
import { isCloudRecordingRunning, isLiveStreamingButtonVisible, isLiveStreamingRunning } from '../../functions';

import { getLiveStreaming } from './functions';

Expand Down Expand Up @@ -132,9 +132,11 @@ export function _mapStateToProps(state: IReduxState, ownProps: IProps) {
const isModerator = isLocalParticipantModerator(state);
const liveStreaming = getLiveStreaming(state);

visible = !isInBreakoutRoom(state)
&& liveStreaming?.enabled
&& isJwtFeatureEnabled(state, 'livestreaming', isModerator, isModerator);
visible = isLiveStreamingButtonVisible({
liveStreamingAllowed: isJwtFeatureEnabled(state, 'livestreaming', isModerator, isModerator),
liveStreamingEnabled: liveStreaming?.enabled,
isInBreakoutRoom: isInBreakoutRoom(state)
});
}

// disable the button if the recording is running.
Expand Down
21 changes: 21 additions & 0 deletions react/features/recording/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,24 @@ export function registerRecordingAudioFiles(dispatch: IStore['dispatch'], should
RECORDING_ON_SOUND_ID,
getSoundFileSrc(RECORDING_ON_SOUND_FILE, language)));
}

/**
* Returns true if the live-streaming button should be visible.
*
* @param {boolean} liveStreamingEnabled - True if the live-streaming is enabled.
* @param {boolean} liveStreamingAllowed - True if the live-streaming feature is enabled in JWT
* or is a moderator if JWT is missing or features are missing in JWT.
* @param {boolean} isInBreakoutRoom - True if in breakout room.
* @returns {boolean}
*/
export function isLiveStreamingButtonVisible({
liveStreamingAllowed,
liveStreamingEnabled,
isInBreakoutRoom
}: {
isInBreakoutRoom: boolean;
liveStreamingAllowed: boolean;
liveStreamingEnabled: boolean;
}) {
return !isInBreakoutRoom && liveStreamingEnabled && liveStreamingAllowed;
}
10 changes: 6 additions & 4 deletions react/features/recording/hooks.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isInBreakoutRoom } from '../breakout-rooms/functions';
import { getLiveStreaming } from './components/LiveStream/functions';
import LiveStreamButton from './components/LiveStream/web/LiveStreamButton';
import RecordButton from './components/Recording/web/RecordButton';
import { getRecordButtonProps } from './functions';
import { getRecordButtonProps, isLiveStreamingButtonVisible } from './functions';


const recording = {
Expand Down Expand Up @@ -52,9 +52,11 @@ export function useLiveStreamingButton() {
const _isInBreakoutRoom = useSelector(isInBreakoutRoom);

if (toolbarButtons?.includes('recording')
&& !_isInBreakoutRoom
&& liveStreaming?.enabled
&& liveStreamingAllowed) {
&& isLiveStreamingButtonVisible({
liveStreamingAllowed,
liveStreamingEnabled: liveStreaming?.enabled,
isInBreakoutRoom: _isInBreakoutRoom
})) {
return livestreaming;
}
}

0 comments on commit d00219c

Please sign in to comment.