Update emojis.ts

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.
This commit is contained in:
Alex Plekhov 2024-02-21 15:49:24 +03:00 committed by GitHub
parent 37e936e1d6
commit d8e527dbbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ export const searchEmojis = async (keyword: string): Promise<IEmoji[]> => {
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