fix: correctly get models and fetchMessages in WhatsApp Web v2.2220.8

* Fix models is undefined

* Feat models is undefined

* Feat models is undefined

* Fix loadEarlierMsgs

* use `getModelsArray()` to get models

* fix: correctly loadEarlierMsgs with ConversationMsgs module

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
This commit is contained in:
Shir Serlui
2022-06-10 06:41:25 +03:00
committed by GitHub
parent b16e1cdf83
commit ebc56bc280
3 changed files with 11 additions and 9 deletions

View File

@@ -179,11 +179,11 @@ class Chat extends Base {
const msgFilter = m => !m.isNotification; // dont include notification messages
const chat = window.Store.Chat.get(chatId);
let msgs = chat.msgs.models.filter(msgFilter);
let msgs = chat.msgs.getModelsArray().filter(msgFilter);
if (searchOptions && searchOptions.limit > 0) {
while (msgs.length < searchOptions.limit) {
const loadedMessages = await chat.loadEarlierMsgs();
const loadedMessages = await window.Store.ConversationMsgs.loadEarlierMsgs(chat);
if (!loadedMessages) break;
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
}