Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
ansuz
2017-09-07 12:45:18 +02:00
23 changed files with 521 additions and 348 deletions

View File

@@ -196,11 +196,14 @@ define([
return store.getProfile().avatar;
}
};
common.getDisplayName = function () {
common.getDisplayName = function (cb) {
var name;
if (getProxy()) {
return getProxy()[common.displayNameKey] || '';
name = getProxy()[common.displayNameKey];
}
return '';
name = name || '';
if (typeof cb === "function") { cb(null, name); }
return name;
};
common.getAccountName = function () {
return localStorage[common.userNameKey];
@@ -481,11 +484,22 @@ define([
var href = getRelativeHref(window.location.href);
getStore().setPadAttribute(href, attr, value, cb);
};
common.setDisplayName = function (value, cb) {
if (getProxy()) {
getProxy()[common.displayNameKey] = value;
}
if (typeof cb === "function") { cb(); }
};
common.setAttribute = function (attr, value, cb) {
getStore().set(["cryptpad", attr].join('.'), value, function (err, data) {
getStore().setAttribute(attr, value, function (err, data) {
if (cb) { cb(err, data); }
});
};
/*common.setAttribute = function (attr, value, cb) {
getStore().set(["cryptpad", attr].join('.'), value, function (err, data) {
if (cb) { cb(err, data); }
});
};*/
common.setLSAttribute = function (attr, value) {
localStorage[attr] = value;
};
@@ -496,10 +510,15 @@ define([
getStore().getPadAttribute(href, attr, cb);
};
common.getAttribute = function (attr, cb) {
getStore().get(["cryptpad", attr].join('.'), function (err, data) {
getStore().getAttribute(attr, function (err, data) {
cb(err, data);
});
};
/*common.getAttribute = function (attr, cb) {
getStore().get(["cryptpad", attr].join('.'), function (err, data) {
cb(err, data);
});
};*/
/* this returns a reference to your proxy. changing it will change your drive.
*/
@@ -663,11 +682,12 @@ define([
};
// STORAGE: Display Name
common.getLastName = function (cb) {
common.getAttribute('username', function (err, userName) {
common.getLastName = common.getDisplayName;
/* function (cb) {
common.getDisplayName(function (err, userName) {
cb(err, userName);
});
};
};*/
var _onDisplayNameChanged = [];
common.onDisplayNameChanged = function (h) {
if (typeof(h) !== "function") { return; }
@@ -694,7 +714,8 @@ define([
var href = typeof padHref === "string" ? padHref : window.location.href;
var parsed = parsePadUrl(href);
if (!parsed.hash) { return; }
href = getRelativeHref(href);
href = parsed.getUrl({present: parsed.present});
//href = getRelativeHref(href);
// getRecentPads return the array from the drive, not a copy
// We don't have to call "set..." at the end, everything is stored with listmap
getRecentPads(function (err, recent) {