Leave the channel when a shared folder is removed from a drive

pull/1/head
yflory 5 years ago
parent 176e667128
commit b6d44b2a1a

@ -98,7 +98,7 @@ define([
var parsed = Hash.parsePadUrl(href);
var secret = Hash.getSecrets('drive', parsed.hash, data.password);
// If we don' have valid keys, abort and remove the proxy to make sure
// If we don't have valid keys, abort and remove the proxy to make sure
// we don't block the drive permanently
if (!secret.keys) {
store.manager.deprecateProxy(id);

@ -168,6 +168,7 @@ define([
if (channelId) { toClean.push(channelId); }
if (exp.isSharedFolder(id)) {
delete files[SHARED_FOLDERS][id];
if (config.removeProxy) { config.removeProxy(id); }
} else {
spliceFileData(id);
}

@ -49,7 +49,6 @@ define([
return userObject;
};
// XXX: Remove a shared folder from the list
var removeProxy = function (Env, id) {
var f = Env.folders[id];
if (!f) { return; }
@ -63,11 +62,13 @@ define([
// In a read-only team, we can't deprecate a shared folder
// Use a empty object with a deprecated flag...
var lm = { proxy: { deprecated: true } };
removeProxy(Env, id);
addProxy(Env, id, lm, function () {});
return void Env.Store.refreshDriveUI();
}
if (channel) { Env.unpinPads([channel], function () {}); }
Env.user.userObject.deprecateSharedFolder(id);
removeProxy(Env, id);
if (Env.Store && Env.Store.refreshDriveUI) {
Env.Store.refreshDriveUI();
}
@ -1065,10 +1066,13 @@ define([
settings: data.settings,
user: {
proxy: proxy,
userObject: UserObject.init(proxy, uoConfig)
},
folders: {}
};
uoConfig.removeProxy = function (id) {
removeProxy(Env, id);
};
Env.user.userObject = UserObject.init(proxy, uoConfig);
var callWithEnv = function (f) {
return function () {

Loading…
Cancel
Save