From e1aeb6e550d7ce339c86ad4432301af7d94fabfd Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Tue, 1 Sep 2026 14:39:56 +0200 Subject: [PATCH 1/3] fix(teams): add timeout to team trim history to not lock owners out of their team --- www/teams/inner.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/teams/inner.js b/www/teams/inner.js index 3b61856e6..26a4ab929 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -429,10 +429,16 @@ define([ ]); UI.openCustomModal(UI.dialog.customModal(div, {buttons: []})); console.log('Trimming team history', APP.team, size); + const removeModalsTimeout = setTimeout(() => { + UI.removeModals(); + Feedback.send(`TRIM_HISTORY_TIMEOUT=${channels.map(obj => obj?.channel).join('|')}`, true); + UI.warn(Messages.trimHistory_error); + }, 120000); APP.history.execCommand('TRIM_HISTORY', { channels: channels }, function(obj) { if (obj && obj.error) { console.error(obj.error); } + clearTimeout(removeModalsTimeout); UI.removeModals(); }); }); From 8cef55f93425848d6836f5bf75a474f2ea8a26af Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Tue, 1 Sep 2026 17:56:05 +0200 Subject: [PATCH 2/3] fix(history): accurate computation of history size --- src/worker/modules/history.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/worker/modules/history.js b/src/worker/modules/history.js index 6effb4d7a..394d4affd 100644 --- a/src/worker/modules/history.js +++ b/src/worker/modules/history.js @@ -161,9 +161,18 @@ const factory = (Util, Hash, UserObject, nThen) => { hash = obj[0].hash; var messages = obj.map(function(data) { - return data.msg; + try { + // Remove txid from received messages + let parsed = JSON.parse(data.msg); + parsed[0] = 0; + return JSON.stringify(parsed); + } catch (e) { + // Invalid message in history: should not happen + return data.msg; + } }); - dataSize = messages.join('\n').length; + // +1 is there for the last new line + dataSize = messages.join('\n').length + 1; }), true); } // Metadata @@ -172,7 +181,8 @@ const factory = (Util, Hash, UserObject, nThen) => { }, waitFor(function (obj) { if (obj && obj.error) { return; } if (!obj || typeof(obj) !== "object") { return; } - metadata = JSON.stringify(obj).length; + // +1 is there for the last new line + metadata = JSON.stringify(obj).length + 1; if (!obj || !Array.isArray(obj.owners) || obj.owners.indexOf(edPublic) === -1) { waitFor.abort(); From 331922afcd862b6b095b6b0ebdc1ca383c2a9c3b Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Fri, 11 Sep 2026 17:16:12 +0200 Subject: [PATCH 3/3] fix: reduce trim history lock timeout - From 2 minutes to 15 seconds --- www/teams/inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/teams/inner.js b/www/teams/inner.js index 26a4ab929..ca329ee78 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -433,7 +433,7 @@ define([ UI.removeModals(); Feedback.send(`TRIM_HISTORY_TIMEOUT=${channels.map(obj => obj?.channel).join('|')}`, true); UI.warn(Messages.trimHistory_error); - }, 120000); + }, 15000); APP.history.execCommand('TRIM_HISTORY', { channels: channels }, function(obj) {