Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Fix problem with dialogs

Ilya Daynatovich8896b0adf332
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 9950b16981..c15e355900 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -83,57 +83,6 @@ JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.CONSTRAINT_FAILED]
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NO_DATA_FROM_SOURCE]
= "dialog.micNotSendingData";
-/**
- * Prompt user for nickname.
- */
-function promptDisplayName() {
- let labelKey = 'dialog.enterDisplayName';
- let message = (
- `<div class="form-control">
- <label data-i18n="${labelKey}" class="form-control__label"></label>
- <input name="displayName" type="text"
- data-i18n="[placeholder]defaultNickname"
- class="input-control" autofocus>
- </div>`
- );
-
- // Don't use a translation string, because we're too early in the call and
- // the translation may not be initialised.
- let buttons = {Ok:true};
-
- let dialog = messageHandler.openDialog(
- 'dialog.displayNameRequired',
- message,
- true,
- buttons,
- function (e, v, m, f) {
- e.preventDefault();
- if (v) {
- let displayName = f.displayName;
- if (displayName) {
- UI.inputDisplayNameHandler(displayName);
- dialog.close();
- return;
- }
- }
- },
- function () {
- let form = $.prompt.getPrompt();
- let input = form.find("input[name='displayName']");
- input.focus();
- let button = form.find("button");
- button.attr("disabled", "disabled");
- input.keyup(function () {
- if (input.val()) {
- button.removeAttr("disabled");
- } else {
- button.attr("disabled", "disabled");
- }
- });
- }
- );
-}
-
/**
* Initialize toolbars with side panels.
*/
@@ -382,12 +331,6 @@ UI.start = function () {
document.title = interfaceConfig.APP_NAME;
- if(config.requireDisplayName) {
- if (!APP.settings.getDisplayName()) {
- promptDisplayName();
- }
- }
-
if (!interfaceConfig.filmStripOnly) {
toastr.options = {
"closeButton": true,
@@ -916,6 +859,59 @@ UI.participantConnectionStatusChanged = function (id, isActive) {
VideoLayout.onParticipantConnectionStatusChanged(id, isActive);
};
+/**
+ * Prompt user for nickname.
+ */
+UI.promptDisplayName = () => {
+ const labelKey = 'dialog.enterDisplayName';
+ const message = (
+ `<div class="form-control">
+ <label data-i18n="${labelKey}" class="form-control__label"></label>
+ <input name="displayName" type="text"
+ data-i18n="[placeholder]defaultNickname"
+ class="input-control" autofocus>
+ </div>`
+ );
+
+ // Don't use a translation string, because we're too early in the call and
+ // the translation may not be initialised.
+ const buttons = { Ok: true };
+
+ const dialog = messageHandler.openDialog(
+ 'dialog.displayNameRequired',
+ message,
+ true,
+ buttons,
+ (e, v, m, f) => {
+ e.preventDefault();
+ if (v) {
+ const displayName = f.displayName;
+
+ if (displayName) {
+ UI.inputDisplayNameHandler(displayName);
+ dialog.close();
+ return;
+ }
+ }
+ },
+ () => {
+ const form = $.prompt.getPrompt();
+ const input = form.find("input[name='displayName']");
+ const button = form.find("button");
+
+ input.focus();
+ button.attr("disabled", "disabled");
+ input.keyup(() => {
+ if (input.val()) {
+ button.removeAttr("disabled");
+ } else {
+ button.attr("disabled", "disabled");
+ }
+ });
+ }
+ );
+};
+
/**
* Update audio level visualization for specified user.
* @param {string} id user id
diff --git a/react/features/base/connection/actions.web.js b/react/features/base/connection/actions.web.js
index 9ffe5e2ec9..652a3504a1 100644
--- a/react/features/base/connection/actions.web.js
+++ b/react/features/base/connection/actions.web.js
@@ -12,6 +12,7 @@ import { appNavigate } from '../../app';
import { setUnsupportedBrowser } from '../../unsupported-browser';
declare var APP: Object;
+declare var config: Object;
const logger = require('jitsi-meet-logger').getLogger(__filename);
@@ -71,6 +72,10 @@ export function connect() {
});
APP.keyboardshortcut.init();
+
+ if (config.requireDisplayName && !APP.settings.getDisplayName()) {
+ APP.UI.promptDisplayName();
+ }
})
.catch(err => {
APP.UI.hideRingOverLay();