From 57a4d0590c7389f2f7b3eef1f9d3039d58d8fcbe Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 8 Jan 2021 16:48:17 +0100 Subject: [PATCH] Guard against forks while in offline mode --- www/common/cryptpad-common.js | 1 - www/common/outer/async-store.js | 5 ++--- www/common/outer/sharedfolder.js | 4 ---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 4bd5171bf..4c64182ee 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -499,7 +499,6 @@ define([ var cb = Util.once(Util.mkAsync(_cb)); var channel = Hash.hrefToHexChannelId(href, password); var error; - var inCache = false; Nthen(function (waitFor) { Cache.getChannelCache(channel, waitFor(function(err, data) { if (err || !data) { return; } diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 41a1d00aa..b0b8d263e 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -2533,8 +2533,6 @@ define([ var onCacheReady = function (clientId, cb) { var proxy = store.proxy; if (store.manager) { return void cb(); } - if (!proxy.settings) { proxy.settings = NEW_USER_SETTINGS; } - if (!proxy.friends_pending) { proxy.friends_pending = {}; } var unpin = function (data, cb) { if (!store.loggedIn) { return void cb(); } Store.unpinPads(null, data, cb); @@ -2579,6 +2577,8 @@ define([ nThen(function (waitFor) { if (manager) { return; } + if (!proxy.settings) { proxy.settings = NEW_USER_SETTINGS; } + if (!proxy.friends_pending) { proxy.friends_pending = {}; } onCacheReady(clientId, waitFor()); manager = store.manager; userObject = store.userObject; @@ -2767,7 +2767,6 @@ define([ // Check if we can connect var to = setTimeout(function () { - console.error('TO'); store.networkTimeout = true; broadcast([], "LOADING_DRIVE", { type: "offline" diff --git a/www/common/outer/sharedfolder.js b/www/common/outer/sharedfolder.js index 21a57576c..7ae165e0b 100644 --- a/www/common/outer/sharedfolder.js +++ b/www/common/outer/sharedfolder.js @@ -183,10 +183,6 @@ define([ }; var rt = sf.rt = Listmap.create(listmapConfig); rt.proxy.on('cacheready', function () { - if (isNew && !Object.keys(rt.proxy).length) { - // New Shared folder: no migration required - rt.proxy.version = 2; - } if (!sf.teams) { return; }