Fixed following by unread

This commit is contained in:
morethanwords 2020-09-01 19:11:29 +03:00
parent c83c377e38
commit b720951241
2 changed files with 3 additions and 3 deletions

View File

@ -2796,7 +2796,7 @@ export class AppImManager {
if(result instanceof Promise) { if(result instanceof Promise) {
cached = false; cached = false;
promise = result.then((result) => { promise = result.then((result) => {
this.log('getHistory not cached result by maxID:', maxID, reverse, isBackLimit, result, peerID); this.log('getHistory not cached result by maxID:', maxID, reverse, isBackLimit, result, peerID, justLoad);
if(justLoad) { if(justLoad) {
this.scrollable.onScroll(); // нужно делать из-за ранней прогрузки this.scrollable.onScroll(); // нужно делать из-за ранней прогрузки
@ -2821,7 +2821,7 @@ export class AppImManager {
return null; return null;
} else { } else {
cached = true; cached = true;
this.log('getHistory cached result by maxID:', maxID, reverse, isBackLimit, result, peerID); this.log('getHistory cached result by maxID:', maxID, reverse, isBackLimit, result, peerID, justLoad);
promise = this.performHistoryResult(result.history || [], reverse, isBackLimit, additionMsgID); promise = this.performHistoryResult(result.history || [], reverse, isBackLimit, additionMsgID);
//return (reverse ? this.getHistoryTopPromise = promise : this.getHistoryBottomPromise = promise); //return (reverse ? this.getHistoryTopPromise = promise : this.getHistoryBottomPromise = promise);
//return this.performHistoryResult(result.history || [], reverse, isBackLimit, additionMsgID, true); //return this.performHistoryResult(result.history || [], reverse, isBackLimit, additionMsgID, true);

View File

@ -4166,7 +4166,7 @@ export class AppMessagesManager {
} }
} }
var history = historyStorage.history.slice(offset, offset + limit); let history = historyStorage.history.slice(backLimit ? Math.max(offset - backLimit, 0) : offset, offset + limit);
if(!maxID && historyStorage.pending.length) { if(!maxID && historyStorage.pending.length) {
history = historyStorage.pending.slice().concat(history); history = historyStorage.pending.slice().concat(history);
} }