From d12603c50af2a364db4beb00cc613d6ab0fd97e4 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 7 Jan 2021 17:55:41 +0100 Subject: [PATCH] Fix shared folder password change with the cache --- www/common/outer/sharedfolder.js | 10 ++++++++-- www/common/proxy-manager.js | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/www/common/outer/sharedfolder.js b/www/common/outer/sharedfolder.js index 658cc463a..21a57576c 100644 --- a/www/common/outer/sharedfolder.js +++ b/www/common/outer/sharedfolder.js @@ -197,7 +197,12 @@ define([ // 1. addProxy won't re-add the same folder twice on 'ready' // 2. obj.cb is using Util.once rt.cache = true; - obj.store.manager.addProxy(obj.id, rt, leave, obj.secondaryKey); + + // If we're updating the password of an existing folder, force the creation + // of a new userobject in proxy-manager. Once it's done, remove this flag + // to make sure we won't create a second new userobject on 'ready' + obj.store.manager.addProxy(obj.id, rt, leave, obj.secondaryKey, config.updatePassword); + config.updatePassword = false; obj.cb(sf.rt); }); sf.ready = true; @@ -220,7 +225,7 @@ define([ }); */ rt.cache = false; - obj.store.manager.addProxy(obj.id, rt, leave, obj.secondaryKey); + obj.store.manager.addProxy(obj.id, rt, leave, obj.secondaryKey, config.updatePassword); obj.cb(sf.rt); }); sf.ready = true; @@ -324,6 +329,7 @@ define([ SF.load({ network: network, store: s, + updatePassword: true, isNewChannel: Store.isNewChannel }, sfId, sf, waitFor()); if (!s.rpc) { return; } diff --git a/www/common/proxy-manager.js b/www/common/proxy-manager.js index 3b95ad925..eb7895161 100644 --- a/www/common/proxy-manager.js +++ b/www/common/proxy-manager.js @@ -16,8 +16,8 @@ define([ }; // Add a shared folder to the list - var addProxy = function (Env, id, lm, leave, editKey) { - if (Env.folders[id]) { + var addProxy = function (Env, id, lm, leave, editKey, force) { + if (Env.folders[id] && !force) { // Shared folder already added to the proxy-manager, probably // a cached version if (Env.folders[id].offline && !lm.cache) {