瀏覽代碼

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.
j8
virtuacoplenny 5 年之前
父節點
當前提交
249dd7b8b8
No account linked to committer's email address

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

@@ -160,7 +160,11 @@ export function getConferenceName(stateful: Function | Object): string {
160 160
     const { callDisplayName } = state['features/base/config'];
161 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,7 +217,7 @@ class DeepLinkingMobilePage extends Component<Props> {
217 217
  */
218 218
 function _mapStateToProps(state) {
219 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,7 +21,7 @@ document.addEventListener('DOMContentLoaded', () => {
21 21
                 ? <DialInSummary
22 22
                     className = 'dial-in-page'
23 23
                     clickableNumbers = { isUsingMobileBrowser }
24
-                    room = { room } />
24
+                    room = { decodeURIComponent(room) } />
25 25
                 : <NoRoomError className = 'dial-in-page' /> }
26 26
         </I18nextProvider>,
27 27
         document.getElementById('react')

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

@@ -13,7 +13,11 @@ import {
13 13
     getLocalParticipant
14 14
 } from '../../../../base/participants';
15 15
 
16
-import { _getDefaultPhoneNumber, getDialInfoPageURL } from '../../../functions';
16
+import {
17
+    _decodeRoomURI,
18
+    _getDefaultPhoneNumber,
19
+    getDialInfoPageURL
20
+} from '../../../functions';
17 21
 import DialInNumber from './DialInNumber';
18 22
 import PasswordForm from './PasswordForm';
19 23
 
@@ -237,7 +241,7 @@ class InfoDialog extends Component<Props, State> {
237 241
                                 className = 'info-dialog-url-text'
238 242
                                 href = { this.props._inviteURL }
239 243
                                 onClick = { this._onClickURLText } >
240
-                                { this._getURLToDisplay() }
244
+                                { decodeURI(this._getURLToDisplay()) }
241 245
                             </a>
242 246
                         </span>
243 247
                     </div>
@@ -288,18 +292,6 @@ class InfoDialog extends Component<Props, State> {
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 296
      * Creates a message describing how to dial in to the conference.
305 297
      *
@@ -309,13 +301,14 @@ class InfoDialog extends Component<Props, State> {
309 301
     _getTextToCopy() {
310 302
         const { _localParticipant, liveStreamViewURL, t } = this.props;
311 303
         const shouldDisplayDialIn = this._shouldDisplayDialIn();
304
+        const _inviteURL = _decodeRoomURI(this.props._inviteURL);
312 305
 
313 306
         let invite = _localParticipant && _localParticipant.name
314 307
             ? t('info.inviteURLFirstPartPersonal', { name: _localParticipant.name })
315 308
             : t('info.inviteURLFirstPartGeneral');
316 309
 
317 310
         invite += t('info.inviteURLSecondPart', {
318
-            url: this.props._inviteURL
311
+            url: _inviteURL
319 312
         });
320 313
 
321 314
         if (liveStreamViewURL) {
@@ -332,8 +325,11 @@ class InfoDialog extends Component<Props, State> {
332 325
                 conferenceID: this.props.dialIn.conferenceID
333 326
             });
334 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 335
             invite = `${invite}\n${dial}\n${moreNumbers}`;
@@ -457,7 +453,12 @@ class InfoDialog extends Component<Props, State> {
457 453
                     phoneNumber = { this.state.phoneNumber } />
458 454
                 <a
459 455
                     className = 'more-numbers'
460
-                    href = { this._getDialInfoPageURL() }
456
+                    href = {
457
+                        getDialInfoPageURL(
458
+                            this.props._conferenceName,
459
+                            this.props._locationURL
460
+                        )
461
+                    }
461 462
                     rel = 'noopener noreferrer'
462 463
                     target = '_blank'>
463 464
                     { this.props.t('info.moreNumbers') }

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

@@ -401,7 +401,7 @@ export function searchDirectory( // eslint-disable-line max-params
401 401
  */
402 402
 export function getShareInfoText(
403 403
         state: Object, inviteUrl: string, useHtml: ?boolean): Promise<string> {
404
-    let roomUrl = inviteUrl;
404
+    let roomUrl = _decodeRoomURI(inviteUrl);
405 405
     const includeDialInfo = state['features/base/config'] !== undefined;
406 406
 
407 407
     if (useHtml) {
@@ -505,7 +505,7 @@ export function getDialInfoPageURL(
505 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,3 +560,22 @@ export function _getDefaultPhoneNumber(
560 560
 
561 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,7 +31,7 @@ function toDisplayableItem(item, defaultServerURL, t) {
31 31
             _toDurationString(item.duration),
32 32
             serverName
33 33
         ],
34
-        title: location.room,
34
+        title: decodeURIComponent(location.room),
35 35
         url: item.conference
36 36
     };
37 37
 }

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

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

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

@@ -192,7 +192,7 @@ export class AbstractWelcomePage extends Component<Props, *> {
192 192
             const onAppNavigateSettled
193 193
                 = () => this._mounted && this.setState({ joining: false });
194 194
 
195
-            this.props.dispatch(appNavigate(room))
195
+            this.props.dispatch(appNavigate(encodeURI(room)))
196 196
                 .then(onAppNavigateSettled, onAppNavigateSettled);
197 197
         }
198 198
     }

Loading…
取消
儲存