From 6f7ecb141f50b9cfe63a37317eaf1e0297f0dc92 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Mon, 29 Mar 2021 15:19:59 -0700 Subject: [PATCH] filterAndSortContacts should tokenize --- ts/test-both/state/selectors/conversations_test.ts | 3 ++- ts/util/filterAndSortContacts.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ts/test-both/state/selectors/conversations_test.ts b/ts/test-both/state/selectors/conversations_test.ts index 167a8fd88a..b14abde894 100644 --- a/ts/test-both/state/selectors/conversations_test.ts +++ b/ts/test-both/state/selectors/conversations_test.ts @@ -551,7 +551,8 @@ describe('both/state/selectors/conversations', () => { const result = getComposeContacts(state); const ids = result.map(contact => contact.id); - assert.deepEqual(ids, ['convo-1', 'convo-5']); + // NOTE: convo-6 matches because you can't write "Sharing" without "in" + assert.deepEqual(ids, ['convo-1', 'convo-5', 'convo-6']); }); }); diff --git a/ts/util/filterAndSortContacts.ts b/ts/util/filterAndSortContacts.ts index c47cc3219b..1fbfd8d414 100644 --- a/ts/util/filterAndSortContacts.ts +++ b/ts/util/filterAndSortContacts.ts @@ -9,6 +9,7 @@ const FUSE_OPTIONS: FuseOptions = { // A small-but-nonzero threshold lets us match parts of E164s better, and makes the // search a little more forgiving. threshold: 0.05, + tokenize: true, keys: [ { name: 'title',