From 1ecc460686221a87e89806cc4614d968d71b18e3 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 18 Jan 2019 15:41:09 +0100 Subject: [PATCH] Fix a backup and restore issue from the settings --- www/settings/main.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) 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',