From 0bf46603094f86c04d46829104a96411213018e4 Mon Sep 17 00:00:00 2001 From: yanas Date: Tue, 19 Apr 2016 16:06:16 -0500 Subject: [PATCH] Fix require display name dialog --- lang/main.json | 4 ++-- modules/UI/UI.js | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lang/main.json b/lang/main.json index 9297b4ebd5..0e5233b05f 100644 --- a/lang/main.json +++ b/lang/main.json @@ -8,7 +8,7 @@ "participant": "Participant", "me": "me", "speaker": "Speaker", - "defaultNickname": "ex. __name__", + "defaultNickname": "ex. Jane Pink", "defaultLink": "e.g. __url__", "welcomepage":{ "go": "GO", @@ -204,7 +204,7 @@ "userPassword": "user password", "token": "token", "tokenAuthFailed": "Failed to authenticate with XMPP server: invalid token", - "displayNameRequired": "Please enter your display name:", + "displayNameRequired": "Please enter your display name", "extensionRequired": "Extension required:", "firefoxExtensionPrompt": "You need to install a Firefox extension in order to use screen sharing. Please try again after you get it from here!", "feedbackQuestion": "How was your call?", diff --git a/modules/UI/UI.js b/modules/UI/UI.js index cafe3ef9d5..8a2e2fa987 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -45,31 +45,32 @@ let followMeHandler; function promptDisplayName() { let nickRequiredMsg = APP.translation.translateString("dialog.displayNameRequired"); - let defaultNickMsg = APP.translation.translateString( - "defaultNickname", {name: "Jane Pink"} - ); + let defaultNickMsg = APP.translation.translateString("defaultNickname"); let message = `

${nickRequiredMsg}

`; - let buttonTxt = APP.translation.generateTranslationHTML("dialog.Ok"); - let buttons = [{title: buttonTxt, value: "ok"}]; + // 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}; - messageHandler.openDialog( - null, message, + let dialog = messageHandler.openDialog( + null, + message, true, buttons, function (e, v, m, f) { - if (v == "ok") { + e.preventDefault(); + if (v) { let displayName = f.displayName; if (displayName) { UI.inputDisplayNameHandler(displayName); - return true; + dialog.close(); + return; } } - e.preventDefault(); }, function () { let form = $.prompt.getPrompt();