Don't show error screen when deleting a loaded pad

pull/1/head
yflory 4 years ago
parent 24e22c4c4f
commit 2fc020761a

@ -2556,6 +2556,13 @@ define([
autoStoreModal[priv.channel].delete();
delete autoStoreModal[priv.channel];
}
if (err.ownDeletion) {
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
(cb || function () {})();
return;
}
// View users have the wrong seed, thay can't retireve access directly
// Version 1 hashes don't support passwords
if (!priv.readOnly && !priv.oldVersionHash) {

@ -319,6 +319,7 @@ define([
});
};
var myDeletions = {};
Store.removeOwnedChannel = function (clientId, data, cb) {
// "data" used to be a string (channelID), now it can also be an object
// data.force tells us we can safely remove the drive ID
@ -331,8 +332,6 @@ define([
teamId = data.teamId;
}
// XXX CLEAR CACHE
if (channel === store.driveChannel && !force) {
return void cb({error: 'User drive removal blocked!'});
}
@ -341,7 +340,11 @@ define([
if (!s) { return void cb({ error: 'ENOTFOUND' }); }
if (!s.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
// If this channel is loaded, remember that we deleted it ourselves
if (Store.channels[channel]) { myDeletions[channel] = true; }
s.rpc.removeOwnedChannel(channel, function (err) {
if (err) { delete myDeletions[channel]; }
cb({error:err});
});
};
@ -1708,6 +1711,11 @@ define([
return;
}
var onError = function (err) {
// If it's a deletion started from this worker, different UI message
if (err && err.type === "EDELETED" && myDeletions[data.channel]) {
delete myDeletions[channel];
err.ownDeletion = true;
}
channel.bcast("PAD_ERROR", err);
if (err && err.type === "EDELETED" && Cache && Cache.clearChannel) {

Loading…
Cancel
Save