From f5beae517efe2675a1edd601fef0055b174012ce Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 6 Sep 2023 01:47:55 +0300 Subject: [PATCH] Case-independent tags dropdown view --- public/scripts/tags.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/scripts/tags.js b/public/scripts/tags.js index f9976319d..7f5809b88 100644 --- a/public/scripts/tags.js +++ b/public/scripts/tags.js @@ -28,7 +28,7 @@ const CHARACTER_FILTER_SELECTOR = '#rm_characters_block .rm_tag_filter'; const GROUP_FILTER_SELECTOR = '#rm_group_chats_block .rm_tag_filter'; function getFilterHelper(listSelector) { - return $(listSelector).is(GROUP_FILTER_SELECTOR) ? groupCandidatesFilter : entitiesFilter; + return $(listSelector).is(GROUP_FILTER_SELECTOR) ? groupCandidatesFilter : entitiesFilter; } export const tag_filter_types = { @@ -170,7 +170,7 @@ function removeTagFromMap(tagId) { function findTag(request, resolve, listSelector) { const skipIds = [...($(listSelector).find(".tag").map((_, el) => $(el).attr("id")))]; - const haystack = tags.filter(t => !skipIds.includes(t.id)).map(t => t.name).sort(); + const haystack = tags.filter(t => !skipIds.includes(t.id)).map(t => t.name).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())); const needle = request.term.toLowerCase(); const hasExactMatch = haystack.findIndex(x => x.toLowerCase() == needle) !== -1; const result = haystack.filter(x => x.toLowerCase().includes(needle));