From d7f1a548fe79551b7db363a35c514c15870b7b16 Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Thu, 29 Aug 2024 14:58:28 +1000 Subject: [PATCH] feat: add note to self inEnglish option to search --- ts/state/ducks/search.ts | 9 +++++---- ts/types/Search.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ts/state/ducks/search.ts b/ts/state/ducks/search.ts index 5e6e1c928..c9d3341d9 100644 --- a/ts/state/ducks/search.ts +++ b/ts/state/ducks/search.ts @@ -68,7 +68,10 @@ export function search(query: string): SearchResultsKickoffActionType { async function doSearch(query: string): Promise { const options: SearchOptions = { - noteToSelf: window.i18n('noteToSelf').toLowerCase(), + noteToSelf: [ + window.i18n('noteToSelf').toLowerCase(), + window.i18n.inEnglish('noteToSelf').toLowerCase(), + ], savedMessages: window.i18n('savedMessages').toLowerCase(), ourNumber: UserUtils.getOurPubKeyStrFromCache(), }; @@ -209,10 +212,8 @@ async function queryContactsAndGroups(providedQuery: string, options: SearchOpti let contactsAndGroups: Array = searchResults.map(conversation => conversation.id); const queryLowered = query.toLowerCase(); - // Inject synthetic Note to Self entry if query matches localized 'Note to Self' if ( - noteToSelf.includes(query) || - noteToSelf.includes(queryLowered) || + noteToSelf.some(str => str.includes(query) || str.includes(queryLowered)) || savedMessages.includes(query) || savedMessages.includes(queryLowered) ) { diff --git a/ts/types/Search.ts b/ts/types/Search.ts index 0206be8a3..a009958aa 100644 --- a/ts/types/Search.ts +++ b/ts/types/Search.ts @@ -1,6 +1,6 @@ export type SearchOptions = { ourNumber: string; - noteToSelf: string; + noteToSelf: Array; savedMessages: string; };