|
|
|
@ -43,28 +43,32 @@ define([
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
sframeChan.on('Q_SETTINGS_DRIVE_GET', function (d, cb) {
|
|
|
|
|
if (d === "full") {
|
|
|
|
|
// We want shared folders too
|
|
|
|
|
}
|
|
|
|
|
Cryptpad.getUserObject(function (obj) {
|
|
|
|
|
if (obj.error) { return void cb(obj); }
|
|
|
|
|
var result = {
|
|
|
|
|
uo: obj,
|
|
|
|
|
sf: {}
|
|
|
|
|
};
|
|
|
|
|
if (!obj.drive || !obj.drive.sharedFolders) { return void cb(result); }
|
|
|
|
|
Utils.nThen(function (waitFor) {
|
|
|
|
|
Object.keys(obj.drive.sharedFolders).forEach(function (id) {
|
|
|
|
|
Cryptpad.getSharedFolder(id, waitFor(function (obj) {
|
|
|
|
|
result.sf[id] = obj;
|
|
|
|
|
}));
|
|
|
|
|
if (d === "full") {
|
|
|
|
|
// We want shared folders too
|
|
|
|
|
var result = {
|
|
|
|
|
uo: obj,
|
|
|
|
|
sf: {}
|
|
|
|
|
};
|
|
|
|
|
if (!obj.drive || !obj.drive.sharedFolders) { return void cb(result); }
|
|
|
|
|
Utils.nThen(function (waitFor) {
|
|
|
|
|
Object.keys(obj.drive.sharedFolders).forEach(function (id) {
|
|
|
|
|
Cryptpad.getSharedFolder(id, waitFor(function (obj) {
|
|
|
|
|
result.sf[id] = obj;
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
cb(result);
|
|
|
|
|
});
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
cb(result);
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// We want only the user object
|
|
|
|
|
cb(obj);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
sframeChan.on('Q_SETTINGS_DRIVE_SET', function (data, cb) {
|
|
|
|
|
if (data && data.uo) { data = data.uo; }
|
|
|
|
|
var sjson = JSON.stringify(data);
|
|
|
|
|
require([
|
|
|
|
|
'/common/cryptget.js',
|
|
|
|
|