瀏覽代碼

fix(invite): decode the meeting name (#4411)

* fix(invite): decode the meeting name

* squash: try to make mobile join same encoded meeting name as web

* Decodes and generated texts for share and copy meeting info.

Decodes in all cases except when it contains a space, as it will generate wrong links when pasted/shared in external applications.
master
virtuacoplenny 6 年之前
父節點
當前提交
249dd7b8b8
沒有連結到貢獻者的電子郵件帳戶。

+ 5
- 1
react/features/base/conference/functions.js 查看文件

160
     const { callDisplayName } = state['features/base/config'];
160
     const { callDisplayName } = state['features/base/config'];
161
     const { pendingSubjectChange, room, subject } = state['features/base/conference'];
161
     const { pendingSubjectChange, room, subject } = state['features/base/conference'];
162
 
162
 
163
-    return pendingSubjectChange || subject || callDisplayName || (callee && callee.name) || _.startCase(room);
163
+    return pendingSubjectChange
164
+        || subject
165
+        || callDisplayName
166
+        || (callee && callee.name)
167
+        || _.startCase(decodeURIComponent(room));
164
 }
168
 }
165
 
169
 
166
 /**
170
 /**

+ 1
- 1
react/features/deep-linking/components/DeepLinkingMobilePage.web.js 查看文件

217
  */
217
  */
218
 function _mapStateToProps(state) {
218
 function _mapStateToProps(state) {
219
     return {
219
     return {
220
-        _room: state['features/base/conference'].room
220
+        _room: decodeURIComponent(state['features/base/conference'].room)
221
     };
221
     };
222
 }
222
 }
223
 
223
 

+ 1
- 1
react/features/invite/components/dial-in-info-page/DialInInfoApp.web.js 查看文件

21
                 ? <DialInSummary
21
                 ? <DialInSummary
22
                     className = 'dial-in-page'
22
                     className = 'dial-in-page'
23
                     clickableNumbers = { isUsingMobileBrowser }
23
                     clickableNumbers = { isUsingMobileBrowser }
24
-                    room = { room } />
24
+                    room = { decodeURIComponent(room) } />
25
                 : <NoRoomError className = 'dial-in-page' /> }
25
                 : <NoRoomError className = 'dial-in-page' /> }
26
         </I18nextProvider>,
26
         </I18nextProvider>,
27
         document.getElementById('react')
27
         document.getElementById('react')

+ 19
- 18
react/features/invite/components/info-dialog/web/InfoDialog.js 查看文件

13
     getLocalParticipant
13
     getLocalParticipant
14
 } from '../../../../base/participants';
14
 } from '../../../../base/participants';
15
 
15
 
16
-import { _getDefaultPhoneNumber, getDialInfoPageURL } from '../../../functions';
16
+import {
17
+    _decodeRoomURI,
18
+    _getDefaultPhoneNumber,
19
+    getDialInfoPageURL
20
+} from '../../../functions';
17
 import DialInNumber from './DialInNumber';
21
 import DialInNumber from './DialInNumber';
18
 import PasswordForm from './PasswordForm';
22
 import PasswordForm from './PasswordForm';
19
 
23
 
237
                                 className = 'info-dialog-url-text'
241
                                 className = 'info-dialog-url-text'
238
                                 href = { this.props._inviteURL }
242
                                 href = { this.props._inviteURL }
239
                                 onClick = { this._onClickURLText } >
243
                                 onClick = { this._onClickURLText } >
240
-                                { this._getURLToDisplay() }
244
+                                { decodeURI(this._getURLToDisplay()) }
241
                             </a>
245
                             </a>
242
                         </span>
246
                         </span>
243
                     </div>
247
                     </div>
288
         );
292
         );
289
     }
293
     }
290
 
294
 
291
-    /**
292
-     * Generates the URL for the static dial in info page.
293
-     *
294
-     * @private
295
-     * @returns {string}
296
-     */
297
-    _getDialInfoPageURL() {
298
-        return getDialInfoPageURL(
299
-            encodeURIComponent(this.props._conferenceName),
300
-            this.props._locationURL);
301
-    }
302
-
303
     /**
295
     /**
304
      * Creates a message describing how to dial in to the conference.
296
      * Creates a message describing how to dial in to the conference.
305
      *
297
      *
309
     _getTextToCopy() {
301
     _getTextToCopy() {
310
         const { _localParticipant, liveStreamViewURL, t } = this.props;
302
         const { _localParticipant, liveStreamViewURL, t } = this.props;
311
         const shouldDisplayDialIn = this._shouldDisplayDialIn();
303
         const shouldDisplayDialIn = this._shouldDisplayDialIn();
304
+        const _inviteURL = _decodeRoomURI(this.props._inviteURL);
312
 
305
 
313
         let invite = _localParticipant && _localParticipant.name
306
         let invite = _localParticipant && _localParticipant.name
314
             ? t('info.inviteURLFirstPartPersonal', { name: _localParticipant.name })
307
             ? t('info.inviteURLFirstPartPersonal', { name: _localParticipant.name })
315
             : t('info.inviteURLFirstPartGeneral');
308
             : t('info.inviteURLFirstPartGeneral');
316
 
309
 
317
         invite += t('info.inviteURLSecondPart', {
310
         invite += t('info.inviteURLSecondPart', {
318
-            url: this.props._inviteURL
311
+            url: _inviteURL
319
         });
312
         });
320
 
313
 
321
         if (liveStreamViewURL) {
314
         if (liveStreamViewURL) {
332
                 conferenceID: this.props.dialIn.conferenceID
325
                 conferenceID: this.props.dialIn.conferenceID
333
             });
326
             });
334
             const moreNumbers = t('info.invitePhoneAlternatives', {
327
             const moreNumbers = t('info.invitePhoneAlternatives', {
335
-                url: this._getDialInfoPageURL(),
336
-                silentUrl: `${this.props._inviteURL}#config.startSilent=true`
328
+                url: getDialInfoPageURL(
329
+                    this.props._conferenceName,
330
+                    this.props._locationURL
331
+                ),
332
+                silentUrl: `${_inviteURL}#config.startSilent=true`
337
             });
333
             });
338
 
334
 
339
             invite = `${invite}\n${dial}\n${moreNumbers}`;
335
             invite = `${invite}\n${dial}\n${moreNumbers}`;
457
                     phoneNumber = { this.state.phoneNumber } />
453
                     phoneNumber = { this.state.phoneNumber } />
458
                 <a
454
                 <a
459
                     className = 'more-numbers'
455
                     className = 'more-numbers'
460
-                    href = { this._getDialInfoPageURL() }
456
+                    href = {
457
+                        getDialInfoPageURL(
458
+                            this.props._conferenceName,
459
+                            this.props._locationURL
460
+                        )
461
+                    }
461
                     rel = 'noopener noreferrer'
462
                     rel = 'noopener noreferrer'
462
                     target = '_blank'>
463
                     target = '_blank'>
463
                     { this.props.t('info.moreNumbers') }
464
                     { this.props.t('info.moreNumbers') }

+ 21
- 2
react/features/invite/functions.js 查看文件

401
  */
401
  */
402
 export function getShareInfoText(
402
 export function getShareInfoText(
403
         state: Object, inviteUrl: string, useHtml: ?boolean): Promise<string> {
403
         state: Object, inviteUrl: string, useHtml: ?boolean): Promise<string> {
404
-    let roomUrl = inviteUrl;
404
+    let roomUrl = _decodeRoomURI(inviteUrl);
405
     const includeDialInfo = state['features/base/config'] !== undefined;
405
     const includeDialInfo = state['features/base/config'] !== undefined;
406
 
406
 
407
     if (useHtml) {
407
     if (useHtml) {
505
         return accumulator;
505
         return accumulator;
506
     }, '');
506
     }, '');
507
 
507
 
508
-    return `${origin}${newPath}/static/dialInInfo.html?room=${conferenceName}`;
508
+    return `${origin}${newPath}/static/dialInInfo.html?room=${_decodeRoomURI(conferenceName)}`;
509
 }
509
 }
510
 
510
 
511
 /**
511
 /**
560
 
560
 
561
     return null;
561
     return null;
562
 }
562
 }
563
+
564
+/**
565
+ * Decodes URI only if doesn't contain a space(' ').
566
+ *
567
+ * @param {string} url - The string to decode.
568
+ * @returns {string} - It the string contains space, encoded value is '%20' returns
569
+ * same string, otherwise decoded one.
570
+ * @private
571
+ */
572
+export function _decodeRoomURI(url: string) {
573
+    let roomUrl = url;
574
+
575
+    // we want to decode urls when the do not contain space, ' ', which url encoded is %20
576
+    if (roomUrl && !roomUrl.includes('%20')) {
577
+        roomUrl = decodeURI(roomUrl);
578
+    }
579
+
580
+    return roomUrl;
581
+}

+ 1
- 1
react/features/recent-list/functions.native.js 查看文件

31
             _toDurationString(item.duration),
31
             _toDurationString(item.duration),
32
             serverName
32
             serverName
33
         ],
33
         ],
34
-        title: location.room,
34
+        title: decodeURIComponent(location.room),
35
         url: item.conference
35
         url: item.conference
36
     };
36
     };
37
 }
37
 }

+ 1
- 1
react/features/recent-list/functions.web.js 查看文件

18
                     date: item.date,
18
                     date: item.date,
19
                     duration: item.duration,
19
                     duration: item.duration,
20
                     time: [ item.date ],
20
                     time: [ item.date ],
21
-                    title: parseURIString(item.conference).room,
21
+                    title: decodeURIComponent(parseURIString(item.conference).room),
22
                     url: item.conference
22
                     url: item.conference
23
                 };
23
                 };
24
             }));
24
             }));

+ 1
- 1
react/features/welcome/components/AbstractWelcomePage.js 查看文件

192
             const onAppNavigateSettled
192
             const onAppNavigateSettled
193
                 = () => this._mounted && this.setState({ joining: false });
193
                 = () => this._mounted && this.setState({ joining: false });
194
 
194
 
195
-            this.props.dispatch(appNavigate(room))
195
+            this.props.dispatch(appNavigate(encodeURI(room)))
196
                 .then(onAppNavigateSettled, onAppNavigateSettled);
196
                 .then(onAppNavigateSettled, onAppNavigateSettled);
197
         }
197
         }
198
     }
198
     }

Loading…
取消
儲存