Fix invisible restricted shared folders in teams

pull/1/head
yflory 4 years ago
parent 5ade53ebba
commit 1edfbadf4e

@ -1624,6 +1624,7 @@ define([
})) {} })) {}
var auth = function () { var auth = function () {
if (!_store) { return void cb('ERESTRICTED'); }
var rpc = _store.rpc; var rpc = _store.rpc;
if (!rpc) { return void cb('ERESTRICTED'); } if (!rpc) { return void cb('ERESTRICTED'); }
rpc.send('COOKIE', '', function (err) { rpc.send('COOKIE', '', function (err) {
@ -1632,7 +1633,7 @@ define([
}; };
// Wait for the RPC we need to be ready and then tyr to authenticate // Wait for the RPC we need to be ready and then tyr to authenticate
if (_store.onRpcReadyEvt) { if (_store && _store.onRpcReadyEvt) {
_store.onRpcReadyEvt.reg(function () { _store.onRpcReadyEvt.reg(function () {
auth(); auth();
}); });
@ -2851,6 +2852,12 @@ define([
drive[Constants.oldStorageKey] = []; drive[Constants.oldStorageKey] = [];
} }
// Drive already exist: return the existing drive, don't load data from legacy store // Drive already exist: return the existing drive, don't load data from legacy store
if (store.manager) {
// If a cache is loading, make sure it is complete before calling onReady
return void onCacheReadyEvt.reg(function () {
onReady(clientId, returned, cb);
});
}
onReady(clientId, returned, cb); onReady(clientId, returned, cb);
}) })
.on('change', ['drive', 'migrate'], function () { .on('change', ['drive', 'migrate'], function () {

@ -17,7 +17,7 @@ define([
// Add a shared folder to the list // Add a shared folder to the list
var addProxy = function (Env, id, lm, leave, editKey, force) { var addProxy = function (Env, id, lm, leave, editKey, force) {
if (Env.folders[id] && !force) { if (Env.folders[id] && !force && !Env.folders[id].restricted) {
// Shared folder already added to the proxy-manager, probably // Shared folder already added to the proxy-manager, probably
// a cached version // a cached version
if (Env.folders[id].offline && !lm.cache) { if (Env.folders[id].offline && !lm.cache) {
@ -26,6 +26,7 @@ define([
} }
return; return;
} }
if (Env.folders[id]) { console.warn(Env.folders[id]); }
var cfg = getConfig(Env); var cfg = getConfig(Env);
cfg.sharedFolder = true; cfg.sharedFolder = true;
cfg.id = id; cfg.id = id;
@ -48,6 +49,7 @@ define([
proxy: lm.proxy, proxy: lm.proxy,
userObject: userObject, userObject: userObject,
leave: leave, leave: leave,
restricted: proxy.restricted,
offline: Boolean(lm.cache) offline: Boolean(lm.cache)
}; };
if (proxy.on) { if (proxy.on) {

@ -42,7 +42,7 @@ define([
if (!drive || !drive.sharedFolders) { if (!drive || !drive.sharedFolders) {
return void cb(); return void cb();
} }
var r = drive.restrictedFolders = drive.restrictedFolders || {}; var r = drive.restrictedFolders = {};
var oldIds = Object.keys(folders); var oldIds = Object.keys(folders);
nThen(function (waitFor) { nThen(function (waitFor) {
Object.keys(drive.sharedFolders).forEach(function (fId) { Object.keys(drive.sharedFolders).forEach(function (fId) {

@ -61,7 +61,7 @@ define([
if (!drive || !drive.sharedFolders) { if (!drive || !drive.sharedFolders) {
return void cb(); return void cb();
} }
var r = drive.restrictedFolders = drive.restrictedFolders || {}; var r = drive.restrictedFolders = {};
var oldIds = Object.keys(folders); var oldIds = Object.keys(folders);
nThen(function (waitFor) { nThen(function (waitFor) {
Object.keys(drive.sharedFolders).forEach(function (fId) { Object.keys(drive.sharedFolders).forEach(function (fId) {
@ -76,7 +76,7 @@ define([
r[fId] = drive.sharedFolders[fId]; r[fId] = drive.sharedFolders[fId];
if (!r[fId].title) { r[fId].title = r[fId].lastTitle; } if (!r[fId].title) { r[fId].title = r[fId].lastTitle; }
} }
if (newObj && (newObj.deprecated || newObj.restricted)) { if (newObj && (newObj.deprecated /*|| newObj.restricted*/)) {
delete folders[fId]; delete folders[fId];
delete drive.sharedFolders[fId]; delete drive.sharedFolders[fId];
if (manager && manager.folders) { if (manager && manager.folders) {

Loading…
Cancel
Save