From 9c6c2297272f8cda48ee79b1bbe1c729d5f8ed4e Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 24 Jun 2020 15:37:21 +0200 Subject: [PATCH] Tell the user when a pad is expired and not deleted --- www/common/sframe-common-outer.js | 7 +++++++ www/common/sframe-common.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index ef983503c..3fbba216d 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -286,6 +286,7 @@ define([ }; var newHref; + var expire; nThen(function (w) { if (parsed.hashData.key || !parsed.hashData.channel) { return; } var edit = parsed.hashData.mode === 'edit'; @@ -308,6 +309,7 @@ define([ if (edit && !res.href) { newHref = res.roHref; } + expire = res.expire; // We have good data, keep the hash in memory newHref = edit ? res.href : (res.roHref || res.href); })); @@ -344,6 +346,11 @@ define([ } // Not a file, so we can use `isNewChannel` Cryptpad.isNewChannel(currentPad.href, password, w(function(e, isNew) { + if (isNew && expire && expire < (+new Date())) { + sframeChan.event("EV_EXPIRED_ERROR"); + waitFor.abort(); + return; + } if (!isNew) { return void todo(); } if (parsed.hashData.mode === 'view' && (password || !parsed.hashData.password)) { // Error, wrong password stored, the view seed has changed with the password diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 48e6782ef..7dc9372c1 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -675,6 +675,12 @@ define([ UI.errorLoadingScreen(Messages.password_error_seed); }); + ctx.sframeChan.on("EV_EXPIRED_ERROR", function () { + funcs.onServerError({ + type: 'EEXPIRED' + }); + }); + ctx.sframeChan.on('EV_LOADING_INFO', function (data) { UI.updateLoadingProgress(data, 'drive'); });