Browse Source

Temp commit 2

master
morethanwords 3 years ago
parent
commit
ffc006557f
  1. 15
      src/helpers/slicedArray.ts
  2. 6
      src/lib/appManagers/appMessagesManager.ts

15
src/helpers/slicedArray.ts

@ -110,13 +110,20 @@ export default class SlicedArray { @@ -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
};
}
}
}

6
src/lib/appManagers/appMessagesManager.ts

@ -4664,7 +4664,9 @@ export class AppMessagesManager { @@ -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 { @@ -4673,7 +4675,7 @@ export class AppMessagesManager {
}
mids.splice(i, 0, maxId);
} */
}
historyStorage.history.insertSlice(mids);

Loading…
Cancel
Save