diff --git a/lang/main.json b/lang/main.json index a753d0a7de9d..fe76403e6c5f 100644 --- a/lang/main.json +++ b/lang/main.json @@ -754,6 +754,9 @@ "gifsMenu": "GIPHY", "groupTitle": "Notifications", "hostAskedUnmute": "The moderator would like you to speak", + "invalidTenant": "Invalid tenant", + "invalidTenantHyphenDescription": "The tenant you are using is invalid (starts or ends with '-').", + "invalidTenantLengthDescription": "The tenant you are using is too long.", "invitedOneMember": "{{name}} has been invited", "invitedThreePlusMembers": "{{name}} and {{count}} others have been invited", "invitedTwoMembers": "{{first}} and {{second}} have been invited", diff --git a/react/features/base/conference/middleware.any.ts b/react/features/base/conference/middleware.any.ts index 91e56b78e6d3..976c3e9f7e1d 100644 --- a/react/features/base/conference/middleware.any.ts +++ b/react/features/base/conference/middleware.any.ts @@ -38,6 +38,7 @@ import { import MiddlewareRegistry from '../redux/MiddlewareRegistry'; import StateListenerRegistry from '../redux/StateListenerRegistry'; import { TRACK_ADDED, TRACK_REMOVED } from '../tracks/actionTypes'; +import { parseURIString } from '../util/uri'; import { CONFERENCE_FAILED, @@ -421,13 +422,27 @@ function _connectionFailed({ dispatch, getState }: IStore, next: Function, actio } if (error.name === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED) { + let notificationAction: Function = showNotification; const notificationProps = { customActionNameKey: [ 'dialog.rejoinNow' ], customActionHandler: [ () => dispatch(reloadNow()) ], descriptionKey: 'notify.connectionFailed' } as INotificationProps; - dispatch(showNotification(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY)); + const { locationURL = { href: '' } as URL } = getState()['features/base/connection']; + const { tenant } = parseURIString(locationURL.href) || {}; + + if (tenant.startsWith('-') || tenant.endsWith('-')) { + notificationProps.descriptionKey = 'notify.invalidTenantHyphenDescription'; + notificationProps.titleKey = 'notify.invalidTenant'; + notificationAction = showErrorNotification; + } else if (tenant.length > 63) { + notificationProps.descriptionKey = 'notify.invalidTenantLengthDescription'; + notificationProps.titleKey = 'notify.invalidTenant'; + notificationAction = showErrorNotification; + } + + dispatch(notificationAction(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY)); } const result = next(action);