From 2d6bc11f9c8ff5290aa7014fcc49c53c0ffa58a8 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 14 Dec 2020 13:51:22 +0100 Subject: [PATCH 1/2] Remove console noise --- customize.dist/loading.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/loading.js b/customize.dist/loading.js index 6e4781aaf..8efca25fd 100644 --- a/customize.dist/loading.js +++ b/customize.dist/loading.js @@ -318,8 +318,8 @@ button:not(.btn).primary:hover{ // Make sure progress doesn't go backward var c = types.indexOf(data.type); - if (c < current) { return console.error(data); } - if (c === current && progress > data.progress) { return console.error(data); } + if (c < current) { return console.debug(data); } + if (c === current && progress > data.progress) { return console.debug(data); } progress = data.progress; try { From eb5c93965a05f227fd9b32d2da882fc8d6b2e025 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 14 Dec 2020 13:51:36 +0100 Subject: [PATCH 2/2] Clear cache when channel or blob is deleted --- www/common/outer/async-store.js | 2 ++ www/common/sframe-common-outer.js | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 90318dba5..58fd28e00 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -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] }); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 44cbb3e3c..b7610f684 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -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