From 80f5ebc0ccc87a5e23e928b34708f4655334e52e Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 12 Nov 2019 17:08:29 +0100 Subject: [PATCH] Fix shared folders not removed from memory in inner --- www/drive/inner.js | 17 +++++++++++++++++ www/teams/inner.js | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/www/drive/inner.js b/www/drive/inner.js index 252ed68dc..1dabf358a 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -58,6 +58,14 @@ define([ APP.newSharedFolder = null; } } + if (newObj && newObj.deprecated) { + delete folders[fId]; + delete drive.sharedFolders[fId]; + if (manager && manager.folders) { + delete manager.folders[fId]; + } + return; + } folders[fId] = folders[fId] || {}; copyObjectValue(folders[fId], newObj); folders[fId].readOnly = !secret.keys.secondaryKey; @@ -69,6 +77,15 @@ define([ manager.folders[fId].userObject.setReadOnly(readOnly, secret.keys.secondaryKey); })); }); + oldIds.forEach(function (fId) { + if (!drive.sharedFolders[fId]) { + delete folders[fId]; + delete drive.sharedFolders[fId]; + if (manager && manager.folders) { + delete manager.folders[fId]; + } + } + }); }).nThen(function () { cb(); }); diff --git a/www/teams/inner.js b/www/teams/inner.js index 98bd1a70a..54e1070a9 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -80,6 +80,16 @@ define([ manager.folders[fId].userObject.setReadOnly(readOnly, secret.keys.secondaryKey); })); }); + // Remove from memory folders that have been deleted from the drive remotely + oldIds.forEach(function (fId) { + if (!drive.sharedFolders[fId]) { + delete folders[fId]; + delete drive.sharedFolders[fId]; + if (manager && manager.folders) { + delete manager.folders[fId]; + } + } + }); }).nThen(function () { cb(); });