|
|
@ -302,12 +302,6 @@ define([
|
|
|
|
myID = info.myID || null;
|
|
|
|
myID = info.myID || null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var getLastName = function (cb) {
|
|
|
|
|
|
|
|
Cryptpad.getAttribute('username', function (err, userName) {
|
|
|
|
|
|
|
|
cb(err, userName || '');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var setName = module.setName = function (newName) {
|
|
|
|
var setName = module.setName = function (newName) {
|
|
|
|
if (typeof(newName) !== 'string') { return; }
|
|
|
|
if (typeof(newName) !== 'string') { return; }
|
|
|
|
var myUserNameTemp = Cryptpad.fixHTML(newName.trim());
|
|
|
|
var myUserNameTemp = Cryptpad.fixHTML(newName.trim());
|
|
|
@ -324,7 +318,6 @@ define([
|
|
|
|
console.error("Couldn't set username");
|
|
|
|
console.error("Couldn't set username");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.userName.lastName = myUserName;
|
|
|
|
|
|
|
|
editor.fire('change');
|
|
|
|
editor.fire('change');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -580,13 +573,6 @@ define([
|
|
|
|
var onInit = realtimeOptions.onInit = function (info) {
|
|
|
|
var onInit = realtimeOptions.onInit = function (info) {
|
|
|
|
userList = info.userList;
|
|
|
|
userList = info.userList;
|
|
|
|
|
|
|
|
|
|
|
|
module.userName = {};
|
|
|
|
|
|
|
|
// The lastName is stored in an object passed to the toolbar so that when the user clicks on
|
|
|
|
|
|
|
|
// the "change display name" button, the prompt already knows his current name
|
|
|
|
|
|
|
|
getLastName(function (err, lastName) {
|
|
|
|
|
|
|
|
module.userName.lastName = lastName;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var config = {
|
|
|
|
var config = {
|
|
|
|
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist', 'newpad'],
|
|
|
|
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist', 'newpad'],
|
|
|
|
userData: userData,
|
|
|
|
userData: userData,
|
|
|
@ -597,10 +583,6 @@ define([
|
|
|
|
defaultName: defaultName,
|
|
|
|
defaultName: defaultName,
|
|
|
|
suggestName: suggestName
|
|
|
|
suggestName: suggestName
|
|
|
|
},
|
|
|
|
},
|
|
|
|
userName: {
|
|
|
|
|
|
|
|
setName: setName,
|
|
|
|
|
|
|
|
lastName: module.userName
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
common: Cryptpad
|
|
|
|
common: Cryptpad
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if (readOnly) {delete config.changeNameID; }
|
|
|
|
if (readOnly) {delete config.changeNameID; }
|
|
|
@ -619,7 +601,6 @@ define([
|
|
|
|
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
|
|
|
|
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Expand / collapse the toolbar
|
|
|
|
// Expand / collapse the toolbar
|
|
|
|
var $existingButton = $bar.find('#cke_1_toolbar_collapser');
|
|
|
|
var $existingButton = $bar.find('#cke_1_toolbar_collapser');
|
|
|
|
var $collapse = Cryptpad.createButton(null, true);
|
|
|
|
var $collapse = Cryptpad.createButton(null, true);
|
|
|
@ -676,6 +657,8 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// set the hash
|
|
|
|
// set the hash
|
|
|
|
if (!readOnly) { Cryptpad.replaceHash(editHash); }
|
|
|
|
if (!readOnly) { Cryptpad.replaceHash(editHash); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cryptpad.onDisplayNameChanged(setName);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// this should only ever get called once, when the chain syncs
|
|
|
|
// this should only ever get called once, when the chain syncs
|
|
|
@ -711,7 +694,7 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getLastName(function (err, lastName) {
|
|
|
|
Cryptpad.getLastName(function (err, lastName) {
|
|
|
|
console.log("Unlocking editor");
|
|
|
|
console.log("Unlocking editor");
|
|
|
|
setEditable(true);
|
|
|
|
setEditable(true);
|
|
|
|
initializing = false;
|
|
|
|
initializing = false;
|
|
|
@ -720,7 +703,7 @@ define([
|
|
|
|
// Update the toolbar list:
|
|
|
|
// Update the toolbar list:
|
|
|
|
// Add the current user in the metadata if he has edit rights
|
|
|
|
// Add the current user in the metadata if he has edit rights
|
|
|
|
if (readOnly) { return; }
|
|
|
|
if (readOnly) { return; }
|
|
|
|
if (typeof(lastName) === 'string' && lastName.length) {
|
|
|
|
if (typeof(lastName) === 'string') {
|
|
|
|
setName(lastName);
|
|
|
|
setName(lastName);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
myData[myID] = {
|
|
|
|
myData[myID] = {
|
|
|
|