diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f236147b8..1cef92b51 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -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) { diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index f20a545ec..b9649da74 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -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) {