Temp commit 2

This commit is contained in:
morethanwords 2021-02-24 16:19:44 +04:00
parent 5fb4ea6670
commit ffc006557f
2 changed files with 15 additions and 6 deletions

View File

@ -110,13 +110,20 @@ export default class SlicedArray {
for(let i = 0; i < this.slices.length; ++i) {
let offset = 0;
const slice = this.slices[i];
if(slice.length < 2) {
continue;
}
for(; offset < slice.length; offset++) {
if(maxId > slice[offset]) {
if(!offset) { // because can't find 3 in [[5,4], [2,1]]
if(maxId >= slice[offset]) {
/* if(!offset) { // because can't find 3 in [[5,4], [2,1]]
return undefined;
}
} */
return {slice, offset: offset - 1};
return {
slice,
offset: maxId === slice[offset] ? offset : offset - 1
};
}
}
}

View File

@ -4664,7 +4664,9 @@ export class AppMessagesManager {
});
const mids = historyResult.messages.map((message) => (message as MyMessage).mid);
/* if(maxId && !mids.includes(maxId)) {
// * add bound manually.
// * offset_id will be inclusive only if there is 'add_offset' <= -1 (-1 - will only include the 'offset_id')
if(maxId && !mids.includes(maxId)) {
let i = 0;
for(const length = mids.length; i < length; ++i) {
if(maxId > mids[i]) {
@ -4673,7 +4675,7 @@ export class AppMessagesManager {
}
mids.splice(i, 0, maxId);
} */
}
historyStorage.history.insertSlice(mids);