fix(highlight) set highlight button visibility based on record button props
This commit is contained in:
parent
f8628dfeef
commit
a2186e8cee
|
@ -15,6 +15,7 @@ import {
|
||||||
import { highlightMeetingMoment } from '../../actions.any';
|
import { highlightMeetingMoment } from '../../actions.any';
|
||||||
import { StartRecordingDialog } from '../../components';
|
import { StartRecordingDialog } from '../../components';
|
||||||
import { PROMPT_RECORDING_NOTIFICATION_ID } from '../../constants';
|
import { PROMPT_RECORDING_NOTIFICATION_ID } from '../../constants';
|
||||||
|
import { getRecordButtonProps } from '../../functions';
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
|
|
||||||
|
@ -106,9 +107,14 @@ export function _abstractMapStateToProps(state: Object) {
|
||||||
const isButtonDisabled = isHighlightMeetingMomentDisabled(state);
|
const isButtonDisabled = isHighlightMeetingMomentDisabled(state);
|
||||||
const { webhookProxyUrl } = state['features/base/config'];
|
const { webhookProxyUrl } = state['features/base/config'];
|
||||||
|
|
||||||
|
const {
|
||||||
|
_disabled: isRecordButtonDisabled,
|
||||||
|
visible: isRecordButtonVisible
|
||||||
|
} = getRecordButtonProps(state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_disabled: !isRecordingRunning,
|
_disabled: !isRecordingRunning,
|
||||||
_isHighlightInProgress: isButtonDisabled,
|
_isHighlightInProgress: isButtonDisabled,
|
||||||
_visible: Boolean(webhookProxyUrl)
|
_visible: isRecordButtonVisible && !isRecordButtonDisabled && Boolean(webhookProxyUrl)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,10 @@ import {
|
||||||
} from '../../../analytics';
|
} from '../../../analytics';
|
||||||
import { IconToggleRecording } from '../../../base/icons';
|
import { IconToggleRecording } from '../../../base/icons';
|
||||||
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
|
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
|
||||||
import {
|
|
||||||
getLocalParticipant,
|
|
||||||
isLocalParticipantModerator
|
|
||||||
} from '../../../base/participants';
|
|
||||||
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
|
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
|
||||||
import { isInBreakoutRoom } from '../../../breakout-rooms/functions';
|
|
||||||
import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';
|
import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';
|
||||||
import { FEATURES } from '../../../jaas/constants';
|
import { FEATURES } from '../../../jaas/constants';
|
||||||
import { getActiveSession } from '../../functions';
|
import { getActiveSession, getRecordButtonProps } from '../../functions';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the React {@code Component} props of
|
* The type of the React {@code Component} props of
|
||||||
|
@ -131,57 +125,20 @@ export default class AbstractRecordButton<P: Props> extends AbstractButton<P, *>
|
||||||
* {@code RecordButton} component.
|
* {@code RecordButton} component.
|
||||||
*
|
*
|
||||||
* @param {Object} state - The Redux state.
|
* @param {Object} state - The Redux state.
|
||||||
* @param {Props} ownProps - The own props of the Component.
|
|
||||||
* @private
|
* @private
|
||||||
* @returns {{
|
* @returns {{
|
||||||
* _disabled: boolean,
|
* _disabled: boolean,
|
||||||
* _isRecordingRunning: boolean,
|
* _isRecordingRunning: boolean,
|
||||||
|
* _tooltip: string,
|
||||||
* visible: boolean
|
* visible: boolean
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
export function _mapStateToProps(state: Object, ownProps: Props): Object {
|
export function _mapStateToProps(state: Object): Object {
|
||||||
let { visible } = ownProps;
|
const {
|
||||||
|
_disabled,
|
||||||
// a button can be disabled/enabled if enableFeaturesBasedOnToken
|
_tooltip,
|
||||||
// is on or if the livestreaming is running.
|
visible
|
||||||
let _disabled;
|
} = getRecordButtonProps(state);
|
||||||
let _tooltip = '';
|
|
||||||
|
|
||||||
if (typeof visible === 'undefined') {
|
|
||||||
// If the containing component provides the visible prop, that is one
|
|
||||||
// above all, but if not, the button should be autonomus and decide on
|
|
||||||
// its own to be visible or not.
|
|
||||||
const isModerator = isLocalParticipantModerator(state);
|
|
||||||
const {
|
|
||||||
enableFeaturesBasedOnToken,
|
|
||||||
fileRecordingsEnabled
|
|
||||||
} = state['features/base/config'];
|
|
||||||
const { features = {} } = getLocalParticipant(state);
|
|
||||||
|
|
||||||
visible = isModerator && fileRecordingsEnabled;
|
|
||||||
|
|
||||||
if (enableFeaturesBasedOnToken) {
|
|
||||||
visible = visible && String(features.recording) === 'true';
|
|
||||||
_disabled = String(features.recording) === 'disabled';
|
|
||||||
if (!visible && !_disabled) {
|
|
||||||
_disabled = true;
|
|
||||||
visible = true;
|
|
||||||
_tooltip = 'dialog.recordingDisabledTooltip';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// disable the button if the livestreaming is running.
|
|
||||||
if (getActiveSession(state, JitsiRecordingConstants.mode.STREAM)) {
|
|
||||||
_disabled = true;
|
|
||||||
_tooltip = 'dialog.recordingDisabledBecauseOfActiveLiveStreamingTooltip';
|
|
||||||
}
|
|
||||||
|
|
||||||
// disable the button if we are in a breakout room.
|
|
||||||
if (isInBreakoutRoom(state)) {
|
|
||||||
_disabled = true;
|
|
||||||
visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_disabled,
|
_disabled,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
|
import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
|
||||||
import { getLocalParticipant } from '../base/participants';
|
import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants';
|
||||||
|
import { isInBreakoutRoom } from '../breakout-rooms/functions';
|
||||||
import { isEnabled as isDropboxEnabled } from '../dropbox';
|
import { isEnabled as isDropboxEnabled } from '../dropbox';
|
||||||
import { extractFqnFromPath } from '../dynamic-branding';
|
import { extractFqnFromPath } from '../dynamic-branding';
|
||||||
|
|
||||||
|
@ -119,6 +120,65 @@ export function getSessionStatusToShow(state: Object, mode: string): ?string {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the recording button props.
|
||||||
|
*
|
||||||
|
* @param {Object} state - The redux state to search in.
|
||||||
|
*
|
||||||
|
* @returns {{
|
||||||
|
* _disabled: boolean,
|
||||||
|
* _tooltip: string,
|
||||||
|
* visible: boolean
|
||||||
|
* }}
|
||||||
|
*/
|
||||||
|
export function getRecordButtonProps(state: Object): ?string {
|
||||||
|
let visible;
|
||||||
|
|
||||||
|
// a button can be disabled/enabled if enableFeaturesBasedOnToken
|
||||||
|
// is on or if the livestreaming is running.
|
||||||
|
let _disabled;
|
||||||
|
let _tooltip = '';
|
||||||
|
|
||||||
|
// If the containing component provides the visible prop, that is one
|
||||||
|
// above all, but if not, the button should be autonomus and decide on
|
||||||
|
// its own to be visible or not.
|
||||||
|
const isModerator = isLocalParticipantModerator(state);
|
||||||
|
const {
|
||||||
|
enableFeaturesBasedOnToken,
|
||||||
|
fileRecordingsEnabled
|
||||||
|
} = state['features/base/config'];
|
||||||
|
const { features = {} } = getLocalParticipant(state);
|
||||||
|
|
||||||
|
visible = isModerator && fileRecordingsEnabled;
|
||||||
|
|
||||||
|
if (enableFeaturesBasedOnToken) {
|
||||||
|
visible = visible && String(features.recording) === 'true';
|
||||||
|
_disabled = String(features.recording) === 'disabled';
|
||||||
|
if (!visible && !_disabled) {
|
||||||
|
_disabled = true;
|
||||||
|
visible = true;
|
||||||
|
_tooltip = 'dialog.recordingDisabledTooltip';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable the button if the livestreaming is running.
|
||||||
|
if (getActiveSession(state, JitsiRecordingConstants.mode.STREAM)) {
|
||||||
|
_disabled = true;
|
||||||
|
_tooltip = 'dialog.recordingDisabledBecauseOfActiveLiveStreamingTooltip';
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable the button if we are in a breakout room.
|
||||||
|
if (isInBreakoutRoom(state)) {
|
||||||
|
_disabled = true;
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
_disabled,
|
||||||
|
_tooltip,
|
||||||
|
visible
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the resource id.
|
* Returns the resource id.
|
||||||
|
|
Loading…
Reference in New Issue