mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
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:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user