pull/1/head
yflory 5 years ago
parent 17103e89fc
commit 580e5b9560

@ -147,6 +147,7 @@ define([
var fd = exp.isSharedFolder(id) ? files[SHARED_FOLDERS][id] : exp.getFileData(id); var fd = exp.isSharedFolder(id) ? files[SHARED_FOLDERS][id] : exp.getFileData(id);
var channelId = fd.channel; var channelId = fd.channel;
// If trying to remove an owned pad, remove it from server also // If trying to remove an owned pad, remove it from server also
/*
if (!sharedFolder && fd.owners && fd.owners.indexOf(edPublic) !== -1 if (!sharedFolder && fd.owners && fd.owners.indexOf(edPublic) !== -1
&& channelId) { && channelId) {
if (channelId) { ownedRemoved.push(channelId); } if (channelId) { ownedRemoved.push(channelId); }
@ -168,6 +169,7 @@ define([
removeOwnedChannel(fd.rtChannel, function () {}); removeOwnedChannel(fd.rtChannel, function () {});
} }
} }
*/
if (fd.lastVersion) { toClean.push(Hash.hrefToHexChannelId(fd.lastVersion)); } if (fd.lastVersion) { toClean.push(Hash.hrefToHexChannelId(fd.lastVersion)); }
if (fd.rtChannel) { toClean.push(fd.rtChannel); } if (fd.rtChannel) { toClean.push(fd.rtChannel); }
if (channelId) { toClean.push(channelId); } if (channelId) { toClean.push(channelId); }

@ -704,6 +704,8 @@ define([
}; };
// Delete permanently some pads or folders // Delete permanently some pads or folders
var _deleteOwned = function (Env, data, cb) {
};
var _delete = function (Env, data, cb) { var _delete = function (Env, data, cb) {
data = data || {}; data = data || {};
var resolved = _resolvePaths(Env, data.paths); var resolved = _resolvePaths(Env, data.paths);
@ -742,8 +744,8 @@ define([
}); });
}); });
} }
uo.delete(resolved.main, waitFor(function (err, _toUnpin, _ownedRemoved) { uo.delete(resolved.main, waitFor(function (err, _toUnpin/*, _ownedRemoved*/) {
ownedRemoved = _ownedRemoved; //ownedRemoved = _ownedRemoved;
if (!Env.unpinPads || !_toUnpin) { return; } if (!Env.unpinPads || !_toUnpin) { return; }
Array.prototype.push.apply(toUnpin, _toUnpin); Array.prototype.push.apply(toUnpin, _toUnpin);
})); }));
@ -752,7 +754,7 @@ define([
// Check if removed owned pads are duplicated in some shared folders // Check if removed owned pads are duplicated in some shared folders
// If that's the case, we have to remove them from the shared folders too // If that's the case, we have to remove them from the shared folders too
// We can do that by adding their paths to the list of pads to remove from shared folders // We can do that by adding their paths to the list of pads to remove from shared folders
if (ownedRemoved) { /*if (ownedRemoved) {
var ids = _findChannels(Env, ownedRemoved); var ids = _findChannels(Env, ownedRemoved);
ids.forEach(function (id) { ids.forEach(function (id) {
var paths = findFile(Env, id); var paths = findFile(Env, id);
@ -765,7 +767,7 @@ define([
} }
}); });
}); });
} }*/
// Delete paths from the shared folders // Delete paths from the shared folders
Object.keys(resolved.folders).forEach(function (id) { Object.keys(resolved.folders).forEach(function (id) {
Env.folders[id].userObject.delete(resolved.folders[id], waitFor(function (err, _toUnpin) { Env.folders[id].userObject.delete(resolved.folders[id], waitFor(function (err, _toUnpin) {
@ -1140,6 +1142,7 @@ define([
getChannelsList: callWithEnv(getChannelsList), getChannelsList: callWithEnv(getChannelsList),
addPad: callWithEnv(addPad), addPad: callWithEnv(addPad),
delete: callWithEnv(_delete), delete: callWithEnv(_delete),
deleteOwned: callWithEnv(_deleteOwned),
// Tools // Tools
findChannel: callWithEnv(findChannel), findChannel: callWithEnv(findChannel),
findHref: callWithEnv(findHref), findHref: callWithEnv(findHref),
@ -1228,6 +1231,14 @@ define([
} }
}, cb); }, cb);
}; };
var deleteOwnedInner = function (Env, paths, cb) {
return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", {
cmd: "deleteOwned",
data: {
paths: paths,
}
}, cb);
};
var restoreInner = function (Env, path, cb) { var restoreInner = function (Env, path, cb) {
return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", { return void Env.sframeChan.query("Q_DRIVE_USEROBJECT", {
cmd: "restore", cmd: "restore",
@ -1416,6 +1427,7 @@ define([
restoreSharedFolder: callWithEnv(restoreSharedFolderInner), restoreSharedFolder: callWithEnv(restoreSharedFolderInner),
convertFolderToSharedFolder: callWithEnv(convertFolderToSharedFolderInner), convertFolderToSharedFolder: callWithEnv(convertFolderToSharedFolderInner),
delete: callWithEnv(deleteInner), delete: callWithEnv(deleteInner),
deleteOwned: callWithEnv(deleteOwnedInner),
restore: callWithEnv(restoreInner), restore: callWithEnv(restoreInner),
setFolderData: callWithEnv(setFolderDataInner), setFolderData: callWithEnv(setFolderDataInner),
// Tools // Tools

Loading…
Cancel
Save