mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-17 19:26:20 +00:00
fix: fetchMessages when msgs length is smaller than limit (#438)
This commit is contained in:
@@ -184,7 +184,8 @@ class Chat extends Base {
|
||||
}
|
||||
|
||||
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
|
||||
return msgs.splice(msgs.length - limit).map(m => window.WWebJS.getMessageModel(m));
|
||||
if (msgs.length > limit) msgs = msgs.splice(msgs.length - limit);
|
||||
return msgs.map(m => window.WWebJS.getMessageModel(m));
|
||||
|
||||
}, this.id._serialized, searchOptions.limit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user