Skip to content

Commit

Permalink
feat: add note to self inEnglish option to search
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerilym committed Aug 29, 2024
1 parent 444ee72 commit b990cd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions ts/state/ducks/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export function search(query: string): SearchResultsKickoffActionType {

async function doSearch(query: string): Promise<SearchResultsPayloadType> {
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(),
};
Expand Down Expand Up @@ -209,10 +212,8 @@ async function queryContactsAndGroups(providedQuery: string, options: SearchOpti
let contactsAndGroups: Array<string> = 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)
) {
Expand Down
2 changes: 1 addition & 1 deletion ts/types/Search.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type SearchOptions = {
ourNumber: string;
noteToSelf: string;
noteToSelf: Array<string>;
savedMessages: string;
};

Expand Down

0 comments on commit b990cd9

Please sign in to comment.