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(); });