From 3991b06256484791f6b2a2e43c2c69535487057c Mon Sep 17 00:00:00 2001 From: Alvaro <110414366+alvaro-signal@users.noreply.github.com> Date: Fri, 12 Aug 2022 10:10:52 -0600 Subject: [PATCH] Increased the distance to support contacts that may have even longer titles --- ts/test-both/util/filterAndSortConversations_test.ts | 6 +++--- ts/util/filterAndSortConversations.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ts/test-both/util/filterAndSortConversations_test.ts b/ts/test-both/util/filterAndSortConversations_test.ts index 104a8c99f..45cdba3f4 100644 --- a/ts/test-both/util/filterAndSortConversations_test.ts +++ b/ts/test-both/util/filterAndSortConversations_test.ts @@ -29,7 +29,7 @@ describe('filterAndSortConversationsByRecent', () => { activeAt: 2, }), getDefaultConversation({ - title: 'A long title ending with burrito', + title: 'A long long long title ending with burrito', }), ]; @@ -45,7 +45,7 @@ describe('filterAndSortConversationsByRecent', () => { 'Boxing Club', 'Abraham Lincoln', 'Not recent', - 'A long title ending with burrito', + 'A long long long title ending with burrito', ]); }); @@ -55,6 +55,6 @@ describe('filterAndSortConversationsByRecent', () => { 'burrito', 'US' ).map(convo => convo.title); - assert.deepEqual(titles, ['A long title ending with burrito']); + assert.deepEqual(titles, ['A long long long title ending with burrito']); }); }); diff --git a/ts/util/filterAndSortConversations.ts b/ts/util/filterAndSortConversations.ts index 6f3919b78..7b68765c6 100644 --- a/ts/util/filterAndSortConversations.ts +++ b/ts/util/filterAndSortConversations.ts @@ -20,8 +20,8 @@ const FUSE_OPTIONS: Fuse.IFuseOptions = { // We sort manually anyway shouldSort: true, // the default of 100 is not enough to catch a word at the end of a convo/group title - // 150 is about right - distance: 150, + // 200 is about right (contact names can get longer than the max for group titles) + distance: 200, keys: [ { name: 'searchableTitle',