Clear cache when channel or blob is deleted

pull/1/head
yflory 4 years ago
parent 2d6bc11f9c
commit eb5c93965a

@ -464,6 +464,7 @@ define([
store.anon_rpc.send("GET_FILE_SIZE", channelId, function (e, response) {
if (e) { return void cb({error: e}); }
if (response && response.length && typeof(response[0]) === 'number') {
if (response[0] === 0) { Cache.clearChannel(channelId); }
return void cb({size: response[0]});
} else {
cb({error: 'INVALID_RESPONSE'});
@ -477,6 +478,7 @@ define([
store.anon_rpc.send("IS_NEW_CHANNEL", channelId, function (e, response) {
if (e) { return void cb({error: e}); }
if (response && response.length && typeof(response[0]) === 'boolean') {
if (response[0]) { Cache.clearChannel(channelId); }
return void cb({
isNew: response[0]
});

@ -480,6 +480,7 @@ define([
// We've received a link without /p/ and it doesn't work without a password: abort
return void todo();
}
// Wrong password or deleted file?
askPassword(true, passwordCfg);
}));
@ -534,6 +535,12 @@ define([
var edPublic, curvePublic, notifications, isTemplate;
var settings = {};
var isSafe = ['debug', 'profile', 'drive', 'teams'].indexOf(currentPad.app) !== -1;
var isDeleted = isNewFile && currentPad.hash.length > 0;
if (isDeleted) {
Utils.Cache.clearChannel(secret.channel);
}
var updateMeta = function () {
//console.log('EV_METADATA_UPDATE');
var metaObj;
@ -577,7 +584,7 @@ define([
upgradeURL: Cryptpad.upgradeURL
},
isNewFile: isNewFile,
isDeleted: isNewFile && currentPad.hash.length > 0,
isDeleted: isDeleted,
password: password,
channel: secret.channel,
enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default

Loading…
Cancel
Save