Переглянути джерело

fix(connection): Detects tenant hyphen and length problems and show notification.

factor2
damencho 11 місяці тому
джерело
коміт
6af4d182d0
2 змінених файлів з 19 додано та 1 видалено
  1. 3
    0
      lang/main.json
  2. 16
    1
      react/features/base/conference/middleware.any.ts

+ 3
- 0
lang/main.json Переглянути файл

@@ -754,6 +754,9 @@
754 754
         "gifsMenu": "GIPHY",
755 755
         "groupTitle": "Notifications",
756 756
         "hostAskedUnmute": "The moderator would like you to speak",
757
+        "invalidTenant": "Invalid tenant",
758
+        "invalidTenantHyphenDescription": "The tenant you are using is invalid (starts or ends with '-').",
759
+        "invalidTenantLengthDescription": "The tenant you are using is too long.",
757 760
         "invitedOneMember": "{{name}} has been invited",
758 761
         "invitedThreePlusMembers": "{{name}} and {{count}} others have been invited",
759 762
         "invitedTwoMembers": "{{first}} and {{second}} have been invited",

+ 16
- 1
react/features/base/conference/middleware.any.ts Переглянути файл

@@ -38,6 +38,7 @@ import {
38 38
 import MiddlewareRegistry from '../redux/MiddlewareRegistry';
39 39
 import StateListenerRegistry from '../redux/StateListenerRegistry';
40 40
 import { TRACK_ADDED, TRACK_REMOVED } from '../tracks/actionTypes';
41
+import { parseURIString } from '../util/uri';
41 42
 
42 43
 import {
43 44
     CONFERENCE_FAILED,
@@ -421,13 +422,27 @@ function _connectionFailed({ dispatch, getState }: IStore, next: Function, actio
421 422
     }
422 423
 
423 424
     if (error.name === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED) {
425
+        let notificationAction: Function = showNotification;
424 426
         const notificationProps = {
425 427
             customActionNameKey: [ 'dialog.rejoinNow' ],
426 428
             customActionHandler: [ () => dispatch(reloadNow()) ],
427 429
             descriptionKey: 'notify.connectionFailed'
428 430
         } as INotificationProps;
429 431
 
430
-        dispatch(showNotification(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY));
432
+        const { locationURL = { href: '' } as URL } = getState()['features/base/connection'];
433
+        const { tenant } = parseURIString(locationURL.href) || {};
434
+
435
+        if (tenant.startsWith('-') || tenant.endsWith('-')) {
436
+            notificationProps.descriptionKey = 'notify.invalidTenantHyphenDescription';
437
+            notificationProps.titleKey = 'notify.invalidTenant';
438
+            notificationAction = showErrorNotification;
439
+        } else if (tenant.length > 63) {
440
+            notificationProps.descriptionKey = 'notify.invalidTenantLengthDescription';
441
+            notificationProps.titleKey = 'notify.invalidTenant';
442
+            notificationAction = showErrorNotification;
443
+        }
444
+
445
+        dispatch(notificationAction(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY));
431 446
     }
432 447
 
433 448
     const result = next(action);

Завантаження…
Відмінити
Зберегти