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:
@@ -809,8 +809,9 @@ class Client extends EventEmitter {
|
||||
return true;
|
||||
}
|
||||
const MAX_PIN_COUNT = 3;
|
||||
if (window.Store.Chat.models.length > MAX_PIN_COUNT) {
|
||||
let maxPinned = window.Store.Chat.models[MAX_PIN_COUNT - 1].pin;
|
||||
const chatModels = window.Store.Chat.getModelsArray();
|
||||
if (chatModels.length > MAX_PIN_COUNT) {
|
||||
let maxPinned = chatModels[MAX_PIN_COUNT - 1].pin;
|
||||
if (maxPinned) {
|
||||
return false;
|
||||
}
|
||||
@@ -1056,7 +1057,7 @@ class Client extends EventEmitter {
|
||||
async getChatsByLabelId(labelId) {
|
||||
const chatIds = await this.pupPage.evaluate(async (labelId) => {
|
||||
const label = window.Store.Label.get(labelId);
|
||||
const labelItems = label.labelItemCollection.models;
|
||||
const labelItems = label.labelItemCollection.getModelsArray();
|
||||
return labelItems.reduce((result, item) => {
|
||||
if (item.parentType === 'Chat') {
|
||||
result.push(item.parentId);
|
||||
@@ -1074,7 +1075,7 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
async getBlockedContacts() {
|
||||
const blockedContacts = await this.pupPage.evaluate(() => {
|
||||
let chatIds = window.Store.Blocklist.models.map(a => a.id._serialized);
|
||||
let chatIds = window.Store.Blocklist.getModelsArray().map(a => a.id._serialized);
|
||||
return Promise.all(chatIds.map(id => window.WWebJS.getContact(id)));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user