mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-12 19:49:59 +05:00
Merge 331922afcd into 04df22a4f8
This commit is contained in:
commit
30470ad0ba
@ -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();
|
||||
|
||||
@ -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);
|
||||
}, 15000);
|
||||
APP.history.execCommand('TRIM_HISTORY', {
|
||||
channels: channels
|
||||
}, function(obj) {
|
||||
if (obj && obj.error) { console.error(obj.error); }
|
||||
clearTimeout(removeModalsTimeout);
|
||||
UI.removeModals();
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user