From 159b6d5cf5454197a10f97e9fd62c978c37922a8 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 26 Oct 2020 17:14:24 +0530 Subject: [PATCH] Update 5.User.ts --- src/WAConnection/5.User.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WAConnection/5.User.ts b/src/WAConnection/5.User.ts index a83a112..796f216 100644 --- a/src/WAConnection/5.User.ts +++ b/src/WAConnection/5.User.ts @@ -98,9 +98,10 @@ export class WAConnection extends Base { * @returns the chats & the cursor to fetch the next page */ async loadChats (count: number, before: string | null, options: WALoadChatOptions = {}) { + const searchString = options.searchString?.toLowerCase() const chats = this.chats.paginated (before, count, options && (chat => ( (typeof options?.custom !== 'function' || options?.custom(chat)) && - (typeof options?.searchString === 'undefined' || chat.name?.includes (options.searchString) || chat.jid?.startsWith(options.searchString)) + (typeof searchString === 'undefined' || chat.name?.toLowerCase().includes (searchString) || chat.jid?.startsWith(searchString)) ))) let loadPP = this.loadProfilePicturesForChatsAutomatically if (typeof options.loadProfilePicture !== 'undefined') loadPP = options.loadProfilePicture