mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-14 12:18:08 +00:00
feat(recording): Disable buttons on active session
This commit is contained in:
@@ -25,6 +25,11 @@ export type Props = AbstractButtonProps & {
|
||||
*/
|
||||
_isLiveStreamRunning: boolean,
|
||||
|
||||
/**
|
||||
* True if the button needs to be disabled.
|
||||
*/
|
||||
_disabled: Boolean,
|
||||
|
||||
/**
|
||||
* The redux {@code dispatch} function.
|
||||
*/
|
||||
@@ -80,6 +85,7 @@ export default class AbstractLiveStreamButton<P: Props>
|
||||
* @param {Props} ownProps - The own props of the Component.
|
||||
* @private
|
||||
* @returns {{
|
||||
* _disabled: boolean,
|
||||
* _isLiveStreamRunning: boolean,
|
||||
* visible: boolean
|
||||
* }}
|
||||
@@ -87,9 +93,9 @@ export default class AbstractLiveStreamButton<P: Props>
|
||||
export function _mapStateToProps(state: Object, ownProps: Props) {
|
||||
let { visible } = ownProps;
|
||||
|
||||
// a button can be disabled/enabled only if enableFeaturesBasedOnToken
|
||||
// is on
|
||||
let disabledByFeatures;
|
||||
// A button can be disabled/enabled only if enableFeaturesBasedOnToken
|
||||
// is on or if the recording is running.
|
||||
let _disabled;
|
||||
|
||||
if (typeof visible === 'undefined') {
|
||||
// If the containing component provides the visible prop, that is one
|
||||
@@ -105,14 +111,19 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
|
||||
|
||||
if (enableFeaturesBasedOnToken) {
|
||||
visible = visible && String(features.livestreaming) === 'true';
|
||||
disabledByFeatures = String(features.livestreaming) === 'disabled';
|
||||
_disabled = String(features.livestreaming) === 'disabled';
|
||||
}
|
||||
}
|
||||
|
||||
// disable the button if the recording is running.
|
||||
if (getActiveSession(state, JitsiRecordingConstants.mode.FILE)) {
|
||||
_disabled = true;
|
||||
}
|
||||
|
||||
return {
|
||||
_disabled,
|
||||
_isLiveStreamRunning: Boolean(
|
||||
getActiveSession(state, JitsiRecordingConstants.mode.STREAM)),
|
||||
disabledByFeatures,
|
||||
visible
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user