From f56f19abc6eb5c20a1eabbe4265dd90f28283fb7 Mon Sep 17 00:00:00 2001 From: Alex Plekhov <33345177+Lao-Ax@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:25:27 +0300 Subject: [PATCH] feat: add search emoji by substring (#5585) Before the fix emoji could be found only by a subsctring from a string start. For example, we have two emojis 1) foo 2) bar_foo When you perform a search by keyword 'foo' only the first one will be found. Now, both will be found. Co-authored-by: Gleidson Daniel Silva --- app/lib/methods/emojis.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/methods/emojis.ts b/app/lib/methods/emojis.ts index 6564470c4..15c742368 100644 --- a/app/lib/methods/emojis.ts +++ b/app/lib/methods/emojis.ts @@ -51,7 +51,7 @@ export const searchEmojis = async (keyword: string): Promise => { const likeString = sanitizeLikeString(keyword); const whereClause = []; if (likeString) { - whereClause.push(Q.where('name', Q.like(`${likeString}%`))); + whereClause.push(Q.where('name', Q.like(`%${likeString}%`))); } const db = database.active; const customEmojisCollection = await db