From e41e6c39ce51b344a609c8b0f2e88acb7631bf30 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 28 Jan 2021 13:58:43 +0100 Subject: [PATCH] Fix profile corrupted cache --- www/profile/inner.js | 8 ++++++++ www/profile/main.js | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/www/profile/inner.js b/www/profile/inner.js index 375f9588c..236576bfd 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -657,8 +657,16 @@ define([ var lm = APP.lm = Listmap.create(listmapConfig); + var onCorruptedCache = function () { + var sframeChan = common.getSframeChannel(); + sframeChan.event("EV_PROFILE_CORRUPTED_CACHE"); + }; + init(); lm.proxy.on('ready', function () { + if (JSON.stringify(lm.proxy) === '{}') { + return void onCorruptedCache(); + } updateValues(lm.proxy); UI.removeLoadingScreen(); common.mailbox.subscribe(["notifications"], { diff --git a/www/profile/main.js b/www/profile/main.js index 523de89b3..53d10fc74 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -70,6 +70,12 @@ define([ Cryptpad.setAvatar(undefined, cb); }); }); + + sframeChan.on('EV_PROFILE_CORRUPTED_CACHE', function () { + Utils.Cache.clearChannel(Utils.secret.channel, function () { + window.location.reload(); + }); + }); }; SFCommonO.start({ getSecrets: getSecrets,