Add account name in metadata manager

pull/1/head
yflory 7 years ago
parent d88704fb50
commit f5855a2870

@ -1,8 +0,0 @@
define([
'jquery'
], function ($) {
var common = {};
return common;
});

@ -198,6 +198,9 @@ define([
} }
return ''; return '';
}; };
common.getAccountName = function () {
return localStorage[common.userNameKey];
};
var randomToken = function () { var randomToken = function () {
return Math.random().toString(16).replace(/0./, ''); return Math.random().toString(16).replace(/0./, '');

@ -5,6 +5,7 @@ define([], function () {
var members = []; var members = [];
var metadataObj = UNINIT; var metadataObj = UNINIT;
var metadataLazyObj = UNINIT; var metadataLazyObj = UNINIT;
var priv = {};
var dirty = true; var dirty = true;
var changeHandlers = []; var changeHandlers = [];
@ -52,6 +53,9 @@ define([], function () {
sframeChan.on('EV_METADATA_UPDATE', function (ev) { sframeChan.on('EV_METADATA_UPDATE', function (ev) {
meta = ev; meta = ev;
if (ev.priv) {
priv = ev.priv;
}
change(true); change(true);
}); });
sframeChan.on('EV_RT_CONNECT', function (ev) { sframeChan.on('EV_RT_CONNECT', function (ev) {
@ -95,6 +99,9 @@ define([], function () {
checkUpdate(false); checkUpdate(false);
var list = members.slice().filter(function (m) { return m.length === 32; }); var list = members.slice().filter(function (m) { return m.length === 32; });
return list.length - Object.keys(metadataObj.users).length; return list.length - Object.keys(metadataObj.users).length;
},
getPrivatedata : function () {
return priv;
} }
}); });
}; };

@ -473,7 +473,7 @@ define([
var titleCfg = { getHeadingText: getHeadingText }; var titleCfg = { getHeadingText: getHeadingText };
Title = Cryptpad.createTitle(titleCfg, realtimeOptions.onLocal, Cryptpad); Title = Cryptpad.createTitle(titleCfg, realtimeOptions.onLocal, Cryptpad);
var configTb = { var configTb = {
displayed: ['userlist'], displayed: ['userlist', 'useradmin'],
//title: Title.getTitleConfig(), //title: Title.getTitleConfig(),
userList: cpNfInner.metadataMgr, userList: cpNfInner.metadataMgr,
readOnly: readOnly, readOnly: readOnly,

@ -47,6 +47,9 @@ define([
profile: Cryptpad.getProfileUrl(), profile: Cryptpad.getProfileUrl(),
curvePublic: Cryptpad.getProxy().curvePublic, curvePublic: Cryptpad.getProxy().curvePublic,
netfluxId: Cryptpad.getNetwork().webChannels[0].myID, netfluxId: Cryptpad.getNetwork().webChannels[0].myID,
},
priv: {
accountName: Cryptpad.getAccountName()
} }
}); });
}); });

Loading…
Cancel
Save