diff --git a/www/settings/main.js b/www/settings/main.js index 13409ec45..ef7d4ab9b 100644 --- a/www/settings/main.js +++ b/www/settings/main.js @@ -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',