Browse Source

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

master
hristoterezov 7 years ago
parent
commit
4d2614660c

+ 1
- 3
react/features/recording/components/Recording/AbstractRecordButton.js View File

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

+ 28
- 8
react/features/recording/components/Recording/StartRecordingDialog.js View File

9
 } from '../../../analytics';
9
 } from '../../../analytics';
10
 import { Dialog } from '../../../base/dialog';
10
 import { Dialog } from '../../../base/dialog';
11
 import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
11
 import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
12
+import {
13
+    getDropboxData,
14
+    isEnabled as isDropboxEnabled
15
+} from '../../../dropbox';
12
 
16
 
13
 import StartRecordingDialogContent from './StartRecordingDialogContent';
17
 import StartRecordingDialogContent from './StartRecordingDialogContent';
14
-import { getDropboxData } from '../../../dropbox';
15
 
18
 
16
 type Props = {
19
 type Props = {
17
 
20
 
25
      */
28
      */
26
     _appKey: string,
29
     _appKey: string,
27
 
30
 
31
+    /**
32
+     * If true the dropbox integration is enabled, otherwise - disabled.
33
+     */
34
+    _isDropboxEnabled: boolean,
35
+
28
     /**
36
     /**
29
      * The dropbox access token.
37
      * The dropbox access token.
30
      */
38
      */
117
      * @returns {void}
125
      * @returns {void}
118
      */
126
      */
119
     _onTokenUpdated() {
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
         if (typeof _token === 'undefined') {
134
         if (typeof _token === 'undefined') {
123
             this.setState({
135
             this.setState({
154
      */
166
      */
155
     render() {
167
     render() {
156
         const { isTokenValid, isValidating, spaceLeft, userName } = this.state;
168
         const { isTokenValid, isValidating, spaceLeft, userName } = this.state;
169
+        const { _isDropboxEnabled } = this.props;
157
 
170
 
158
         return (
171
         return (
159
             <Dialog
172
             <Dialog
160
-                okDisabled = { !isTokenValid }
173
+                okDisabled = { !isTokenValid && _isDropboxEnabled }
161
                 okTitleKey = 'dialog.confirm'
174
                 okTitleKey = 'dialog.confirm'
162
                 onSubmit = { this._onSubmit }
175
                 onSubmit = { this._onSubmit }
163
                 titleKey = 'dialog.recording'
176
                 titleKey = 'dialog.recording'
164
                 width = 'small'>
177
                 width = 'small'>
165
                 <StartRecordingDialogContent
178
                 <StartRecordingDialogContent
179
+                    integrationsEnabled = { _isDropboxEnabled }
166
                     isTokenValid = { isTokenValid }
180
                     isTokenValid = { isTokenValid }
167
                     isValidating = { isValidating }
181
                     isValidating = { isValidating }
168
                     spaceLeft = { spaceLeft }
182
                     spaceLeft = { spaceLeft }
183
         sendAnalytics(
197
         sendAnalytics(
184
             createRecordingDialogEvent('start', 'confirm.button')
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
                 'file_recording_metadata': {
205
                 'file_recording_metadata': {
192
                     'upload_credentials': {
206
                     'upload_credentials': {
193
                         'service_name': 'dropbox',
207
                         'service_name': 'dropbox',
194
                         'token': _token
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
         return true;
219
         return true;
227
     return {
246
     return {
228
         _appKey: dropbox.appKey,
247
         _appKey: dropbox.appKey,
229
         _conference: state['features/base/conference'].conference,
248
         _conference: state['features/base/conference'].conference,
249
+        _isDropboxEnabled: isDropboxEnabled(state),
230
         _token: state['features/dropbox'].token
250
         _token: state['features/dropbox'].token
231
     };
251
     };
232
 }
252
 }

+ 32
- 0
react/features/recording/components/Recording/StartRecordingDialogContent.js View File

26
      */
26
      */
27
     dispatch: Function,
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
      * <tt>true</tt> if we have valid oauth token.
35
      * <tt>true</tt> if we have valid oauth token.
31
      */
36
      */
79
      * @returns {React$Component}
84
      * @returns {React$Component}
80
      */
85
      */
81
     render() {
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
         const { isTokenValid, isValidating, t } = this.props;
114
         const { isTokenValid, isValidating, t } = this.props;
83
 
115
 
84
         let content = null;
116
         let content = null;

Loading…
Cancel
Save