From ef37dcd7e4a056c474e64db6069a96cc79b3142c Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 4 Nov 2016 16:11:33 +0100 Subject: [PATCH 1/2] add note about how missing keys are treated --- customize.dist/translations/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/customize.dist/translations/README.md b/customize.dist/translations/README.md index 36c43448e..8bde27e08 100644 --- a/customize.dist/translations/README.md +++ b/customize.dist/translations/README.md @@ -107,6 +107,9 @@ define(function () { It's important that you modify just the string, and not the variable name which is used to access its content. For instance, changing `_languageName` to `_language_name` would make the string `'Pirate'` inaccessible to the rest of the codebase. +If a key is not found in your translation, the default English version of that key will be used. +This is to make sure that buttons and other interface elements are not empty, but it's obviously not ideal. + ## Verifying Your Translations It's advisable to save your translation file frequently, and reload Cryptpad in your browser to check that there are no errors in your translation file. From 002e22ee9a6736c8e0f7962b9f76cde73d3ca61f Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 4 Nov 2016 16:17:59 +0100 Subject: [PATCH 2/2] turn off unwanted behaviour until we can do it correctly --- www/poll/main.js | 57 ++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/www/poll/main.js b/www/poll/main.js index 4cf46da73..6eb063487 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -72,6 +72,23 @@ define([ }); }; + var getLastName = module.getLastName = function (cb) { + Cryptpad.getAttribute('username', function (err, userName) { + cb(err, userName || ''); + }); + }; + + var setName = module.setName = function (uname, cb) { + if (typeof(uname) !== 'string') { + return void cb(new Error('expected string')); + } + uname = Cryptpad.fixHTML(uname.trim()).slice(0, 32); + Cryptpad.setAttribute('username', uname, function (err, data) { + if (err) { return void cb(err); } + cb(void 0, uname); + }); + }; + module.Wizard = Wizard; // special UI elements @@ -825,6 +842,10 @@ define([ setEditable(true); + return; + + // shortcircuiting before all of this code since it's not quite the + // behaviour we want, and it's a bit of work to make it Do The Right Thing if (First) { // assume the first user to the poll wants to be the administrator... @@ -840,39 +861,33 @@ define([ module.activeColumn = ''; var promptForName = function () { - // HERE - Cryptpad.prompt(Messages.promptName, "", function (name, ev) { - if (name === null) { - name = ''; - } - if (!module.isEditable) { return; } + var followUp = function (name) { + if (!name) { return; } var id = module.activeColumn = coluid(); Cryptpad.setPadAttribute('column', id, function (err) { - if (err) { - console.error("Couldn't remember your column id"); - return; - } - - console.log(id); + if (err) { return void console.error("Couldn't remember your column id"); } makeUser(module.rt.proxy, id, name).focus().val(name); makeUserEditable(id, true); }); + }; + + getLastName(function (err, uname) { + if (!uname) { + return void Cryptpad.prompt(Messages.promptName, "", function (name, ev) { + if (!(name || module.isEditable)) { return; } + followUp(name); + }); + } + followUp(uname); }); }; - if (column === null) { - //console.log("Looks like you're new to this poll, why don't you make a column"); - promptForName(); - return; - } + if (column === null) { return void promptForName(); } // column might be defined, but that column might have been deleted... - if (proxy.table.colsOrder.indexOf(column) === -1) { - promptForName(); - return; - } + if (proxy.table.colsOrder.indexOf(column) === -1) { return void promptForName(); } }); };