mirror of https://github.com/xwiki-labs/cryptpad
Fix history range
This commit is contained in:
parent
5840703d06
commit
f5908e5f57
|
@ -348,10 +348,7 @@ const getOlderHistory = function (data, cb) {
|
|||
if (hash === oldestKnownHash) {
|
||||
found = true;
|
||||
}
|
||||
messages.push({
|
||||
msg: parsed,
|
||||
hash: hash,
|
||||
});
|
||||
messages.push(parsed);
|
||||
}, function (err) {
|
||||
var toSend = [];
|
||||
if (typeof (desiredMessages) === "number") {
|
||||
|
@ -359,14 +356,14 @@ const getOlderHistory = function (data, cb) {
|
|||
} else if (untilHash) {
|
||||
for (var j = messages.length - 1; j >= 0; j--) {
|
||||
toSend.unshift(messages[j]);
|
||||
if (messages[j] && messages[j].hash === untilHash) {
|
||||
if (Array.isArray(messages[j]) && HK.getHash(messages[j][4]) === untilHash) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let cpCount = 0;
|
||||
for (var i = messages.length - 1; i >= 0; i--) {
|
||||
if (/^cp\|/.test(messages[i].msg[4]) && i !== (messages.length - 1)) {
|
||||
if (/^cp\|/.test(messages[i][4]) && i !== (messages.length - 1)) {
|
||||
cpCount++;
|
||||
}
|
||||
toSend.unshift(messages[i]);
|
||||
|
|
Loading…
Reference in New Issue