From bf222c5094def992d00c0cf005f1a501aec63428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 16 Aug 2022 16:08:55 +0200 Subject: [PATCH] fix(highlight) check for JaaS features before opening the dialog --- .../components/Recording/AbstractHighlightButton.js | 13 ++++++++----- .../components/Recording/web/HighlightButton.js | 11 +++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/react/features/recording/components/Recording/AbstractHighlightButton.js b/react/features/recording/components/Recording/AbstractHighlightButton.js index 571be7bf4..c59154218 100644 --- a/react/features/recording/components/Recording/AbstractHighlightButton.js +++ b/react/features/recording/components/Recording/AbstractHighlightButton.js @@ -1,11 +1,12 @@ // @flow import { Component } from 'react'; -import { batch } from 'react-redux'; import { getActiveSession, isHighlightMeetingMomentDisabled } from '../..'; import { openDialog } from '../../../base/dialog'; import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet'; +import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions'; +import { FEATURES } from '../../../jaas/constants'; import { hideNotification, NOTIFICATION_TIMEOUT_TYPE, @@ -76,11 +77,13 @@ export default class AbstractHighlightButton extends Component

{ titleKey: 'recording.highlightMoment', uid: PROMPT_RECORDING_NOTIFICATION_ID, customActionNameKey: [ 'localRecording.start' ], - customActionHandler: [ () => { - batch(() => { - dispatch(hideNotification(PROMPT_RECORDING_NOTIFICATION_ID)); + customActionHandler: [ async () => { + dispatch(hideNotification(PROMPT_RECORDING_NOTIFICATION_ID)); + const dialogShown = await dispatch(maybeShowPremiumFeatureDialog(FEATURES.RECORDING)); + + if (!dialogShown) { dispatch(openDialog(StartRecordingDialog)); - }); + } } ], appearance: NOTIFICATION_TYPE.NORMAL }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM)); diff --git a/react/features/recording/components/Recording/web/HighlightButton.js b/react/features/recording/components/Recording/web/HighlightButton.js index c15b87ebf..460045cad 100644 --- a/react/features/recording/components/Recording/web/HighlightButton.js +++ b/react/features/recording/components/Recording/web/HighlightButton.js @@ -10,6 +10,8 @@ import { Label } from '../../../../base/label'; import { connect } from '../../../../base/redux'; import { Tooltip } from '../../../../base/tooltip'; import BaseTheme from '../../../../base/ui/components/BaseTheme'; +import { maybeShowPremiumFeatureDialog } from '../../../../jaas/actions'; +import { FEATURES } from '../../../../jaas/constants'; import { StartRecordingDialog } from '../../../components'; import AbstractHighlightButton, { _abstractMapStateToProps, @@ -129,8 +131,13 @@ export class HighlightButton extends AbstractHighlightButton { * * @returns {void} */ - _onOpenDialog() { - this.props.dispatch(openDialog(StartRecordingDialog)); + async _onOpenDialog() { + const { dispatch } = this.props; + const dialogShown = await dispatch(maybeShowPremiumFeatureDialog(FEATURES.RECORDING)); + + if (!dialogShown) { + dispatch(openDialog(StartRecordingDialog)); + } } /**