Pārlūkot izejas kodu

fix(recording): Show the button when the dropbox integration is disabled

master
hristoterezov 7 gadus atpakaļ
vecāks
revīzija
4d2614660c

+ 1
- 3
react/features/recording/components/Recording/AbstractRecordButton.js Parādīt failu

@@ -11,7 +11,6 @@ import {
11 11
     getLocalParticipant,
12 12
     isLocalParticipantModerator
13 13
 } from '../../../base/participants';
14
-import { isEnabled as isDropboxEnabled } from '../../../dropbox';
15 14
 import {
16 15
     AbstractButton,
17 16
     type AbstractButtonProps
@@ -130,8 +129,7 @@ export function _mapStateToProps(state: Object, ownProps: Props): Object {
130 129
         const { features = {} } = getLocalParticipant(state);
131 130
 
132 131
         visible = isModerator
133
-            && fileRecordingsEnabled
134
-            && isDropboxEnabled(state);
132
+            && fileRecordingsEnabled;
135 133
 
136 134
         if (enableFeaturesBasedOnToken) {
137 135
             visible = visible && String(features.recording) === 'true';

+ 28
- 8
react/features/recording/components/Recording/StartRecordingDialog.js Parādīt failu

@@ -9,9 +9,12 @@ import {
9 9
 } from '../../../analytics';
10 10
 import { Dialog } from '../../../base/dialog';
11 11
 import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
12
+import {
13
+    getDropboxData,
14
+    isEnabled as isDropboxEnabled
15
+} from '../../../dropbox';
12 16
 
13 17
 import StartRecordingDialogContent from './StartRecordingDialogContent';
14
-import { getDropboxData } from '../../../dropbox';
15 18
 
16 19
 type Props = {
17 20
 
@@ -25,6 +28,11 @@ type Props = {
25 28
      */
26 29
     _appKey: string,
27 30
 
31
+    /**
32
+     * If true the dropbox integration is enabled, otherwise - disabled.
33
+     */
34
+    _isDropboxEnabled: boolean,
35
+
28 36
     /**
29 37
      * The dropbox access token.
30 38
      */
@@ -117,7 +125,11 @@ class StartRecordingDialog extends Component<Props, State> {
117 125
      * @returns {void}
118 126
      */
119 127
     _onTokenUpdated() {
120
-        const { _appKey, _token } = this.props;
128
+        const { _appKey, _isDropboxEnabled, _token } = this.props;
129
+
130
+        if (!_isDropboxEnabled) {
131
+            return;
132
+        }
121 133
 
122 134
         if (typeof _token === 'undefined') {
123 135
             this.setState({
@@ -154,15 +166,17 @@ class StartRecordingDialog extends Component<Props, State> {
154 166
      */
155 167
     render() {
156 168
         const { isTokenValid, isValidating, spaceLeft, userName } = this.state;
169
+        const { _isDropboxEnabled } = this.props;
157 170
 
158 171
         return (
159 172
             <Dialog
160
-                okDisabled = { !isTokenValid }
173
+                okDisabled = { !isTokenValid && _isDropboxEnabled }
161 174
                 okTitleKey = 'dialog.confirm'
162 175
                 onSubmit = { this._onSubmit }
163 176
                 titleKey = 'dialog.recording'
164 177
                 width = 'small'>
165 178
                 <StartRecordingDialogContent
179
+                    integrationsEnabled = { _isDropboxEnabled }
166 180
                     isTokenValid = { isTokenValid }
167 181
                     isValidating = { isValidating }
168 182
                     spaceLeft = { spaceLeft }
@@ -183,18 +197,23 @@ class StartRecordingDialog extends Component<Props, State> {
183 197
         sendAnalytics(
184 198
             createRecordingDialogEvent('start', 'confirm.button')
185 199
         );
186
-        const { _conference, _token } = this.props;
200
+        const { _conference, _isDropboxEnabled, _token } = this.props;
201
+        let appData;
187 202
 
188
-        _conference.startRecording({
189
-            mode: JitsiRecordingConstants.mode.FILE,
190
-            appData: JSON.stringify({
203
+        if (_isDropboxEnabled) {
204
+            appData = JSON.stringify({
191 205
                 'file_recording_metadata': {
192 206
                     'upload_credentials': {
193 207
                         'service_name': 'dropbox',
194 208
                         'token': _token
195 209
                     }
196 210
                 }
197
-            })
211
+            });
212
+        }
213
+
214
+        _conference.startRecording({
215
+            mode: JitsiRecordingConstants.mode.FILE,
216
+            appData
198 217
         });
199 218
 
200 219
         return true;
@@ -227,6 +246,7 @@ function mapStateToProps(state: Object) {
227 246
     return {
228 247
         _appKey: dropbox.appKey,
229 248
         _conference: state['features/base/conference'].conference,
249
+        _isDropboxEnabled: isDropboxEnabled(state),
230 250
         _token: state['features/dropbox'].token
231 251
     };
232 252
 }

+ 32
- 0
react/features/recording/components/Recording/StartRecordingDialogContent.js Parādīt failu

@@ -26,6 +26,11 @@ type Props = {
26 26
      */
27 27
     dispatch: Function,
28 28
 
29
+    /**
30
+     * If true the content related to the integrations will be shown.
31
+     */
32
+    integrationsEnabled: boolean,
33
+
29 34
     /**
30 35
      * <tt>true</tt> if we have valid oauth token.
31 36
      */
@@ -79,6 +84,33 @@ class StartRecordingDialogContent extends Component<Props> {
79 84
      * @returns {React$Component}
80 85
      */
81 86
     render() {
87
+        if (this.props.integrationsEnabled) {
88
+            return this._renderIntegrationsContent();
89
+        }
90
+
91
+        return this._renderNoIntegrationsContent();
92
+    }
93
+
94
+    /**
95
+     * Renders the content in case no integrations were enabled.
96
+     *
97
+     * @returns {React$Component}
98
+     */
99
+    _renderNoIntegrationsContent() {
100
+        return (
101
+            <Container>
102
+                { this.props.t('recording.startRecordingBody') }
103
+            </Container>
104
+        );
105
+    }
106
+
107
+    /**
108
+     * Renders the content in case integrations were enabled.
109
+     *
110
+     * @protected
111
+     * @returns {React$Component}
112
+     */
113
+    _renderIntegrationsContent() {
82 114
         const { isTokenValid, isValidating, t } = this.props;
83 115
 
84 116
         let content = null;

Notiek ielāde…
Atcelt
Saglabāt