mirror of https://github.com/xwiki-labs/cryptpad
Leave the channel when a shared folder is removed from a drive
This commit is contained in:
parent
176e667128
commit
b6d44b2a1a
|
@ -98,7 +98,7 @@ define([
|
||||||
|
|
||||||
var parsed = Hash.parsePadUrl(href);
|
var parsed = Hash.parsePadUrl(href);
|
||||||
var secret = Hash.getSecrets('drive', parsed.hash, data.password);
|
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
|
// we don't block the drive permanently
|
||||||
if (!secret.keys) {
|
if (!secret.keys) {
|
||||||
store.manager.deprecateProxy(id);
|
store.manager.deprecateProxy(id);
|
||||||
|
|
|
@ -168,6 +168,7 @@ define([
|
||||||
if (channelId) { toClean.push(channelId); }
|
if (channelId) { toClean.push(channelId); }
|
||||||
if (exp.isSharedFolder(id)) {
|
if (exp.isSharedFolder(id)) {
|
||||||
delete files[SHARED_FOLDERS][id];
|
delete files[SHARED_FOLDERS][id];
|
||||||
|
if (config.removeProxy) { config.removeProxy(id); }
|
||||||
} else {
|
} else {
|
||||||
spliceFileData(id);
|
spliceFileData(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ define([
|
||||||
return userObject;
|
return userObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX: Remove a shared folder from the list
|
|
||||||
var removeProxy = function (Env, id) {
|
var removeProxy = function (Env, id) {
|
||||||
var f = Env.folders[id];
|
var f = Env.folders[id];
|
||||||
if (!f) { return; }
|
if (!f) { return; }
|
||||||
|
@ -63,11 +62,13 @@ define([
|
||||||
// In a read-only team, we can't deprecate a shared folder
|
// In a read-only team, we can't deprecate a shared folder
|
||||||
// Use a empty object with a deprecated flag...
|
// Use a empty object with a deprecated flag...
|
||||||
var lm = { proxy: { deprecated: true } };
|
var lm = { proxy: { deprecated: true } };
|
||||||
|
removeProxy(Env, id);
|
||||||
addProxy(Env, id, lm, function () {});
|
addProxy(Env, id, lm, function () {});
|
||||||
return void Env.Store.refreshDriveUI();
|
return void Env.Store.refreshDriveUI();
|
||||||
}
|
}
|
||||||
if (channel) { Env.unpinPads([channel], function () {}); }
|
if (channel) { Env.unpinPads([channel], function () {}); }
|
||||||
Env.user.userObject.deprecateSharedFolder(id);
|
Env.user.userObject.deprecateSharedFolder(id);
|
||||||
|
removeProxy(Env, id);
|
||||||
if (Env.Store && Env.Store.refreshDriveUI) {
|
if (Env.Store && Env.Store.refreshDriveUI) {
|
||||||
Env.Store.refreshDriveUI();
|
Env.Store.refreshDriveUI();
|
||||||
}
|
}
|
||||||
|
@ -1065,10 +1066,13 @@ define([
|
||||||
settings: data.settings,
|
settings: data.settings,
|
||||||
user: {
|
user: {
|
||||||
proxy: proxy,
|
proxy: proxy,
|
||||||
userObject: UserObject.init(proxy, uoConfig)
|
|
||||||
},
|
},
|
||||||
folders: {}
|
folders: {}
|
||||||
};
|
};
|
||||||
|
uoConfig.removeProxy = function (id) {
|
||||||
|
removeProxy(Env, id);
|
||||||
|
};
|
||||||
|
Env.user.userObject = UserObject.init(proxy, uoConfig);
|
||||||
|
|
||||||
var callWithEnv = function (f) {
|
var callWithEnv = function (f) {
|
||||||
return function () {
|
return function () {
|
||||||
|
|
Loading…
Reference in New Issue