π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
R
Manav Rathi45b0dd4887b6
diff --git a/web/packages/new/photos/services/search/index.ts b/web/packages/new/photos/services/search/index.tsindex 29115122cd..4e00757b79 100644--- a/web/packages/new/photos/services/search/index.ts+++ b/web/packages/new/photos/services/search/index.ts@@ -9,8 +9,8 @@ import { clipMatches, isMLEnabled } from "../ml";import type {City,ClipSearchScores,- DateSearchResult,LabelledFileType,+ LabelledSearchDateComponents,LocalizedSearchData,SearchableData,SearchDateComponents,@@ -144,7 +144,7 @@ const localizedSearchData = () =>/*** A list of holidays - their yearly dates and localized names.*/-const holidays = (): DateSearchResult[] => [+const holidays = (): LabelledSearchDateComponents[] => [{ components: { month: 12, day: 25 }, label: t("CHRISTMAS") },{ components: { month: 12, day: 24 }, label: t("CHRISTMAS_EVE") },{ components: { month: 1, day: 1 }, label: t("NEW_YEAR") },diff --git a/web/packages/new/photos/services/search/types.ts b/web/packages/new/photos/services/search/types.tsindex a15b9288ec..c386684d85 100644--- a/web/packages/new/photos/services/search/types.ts+++ b/web/packages/new/photos/services/search/types.ts@@ -51,9 +51,7 @@ export interface SearchableData {files: EnteFile[];}-// TODO-cgroup: Audit below--export interface DateSearchResult {+export interface LabelledSearchDateComponents {components: SearchDateComponents;label: string;}@@ -83,7 +81,7 @@ export type Searchable<T> = T & {*/export interface LocalizedSearchData {locale: string;- holidays: Searchable<DateSearchResult>[];+ holidays: Searchable<LabelledSearchDateComponents>[];labelledFileTypes: Searchable<LabelledFileType>[];}diff --git a/web/packages/new/photos/services/search/worker.ts b/web/packages/new/photos/services/search/worker.tsindex ba2627da7b..354327e21c 100644--- a/web/packages/new/photos/services/search/worker.ts+++ b/web/packages/new/photos/services/search/worker.ts@@ -16,8 +16,8 @@ import {} from "../user-entity";import type {City,- DateSearchResult,LabelledFileType,+ LabelledSearchDateComponents,LocalizedSearchData,Searchable,SearchableData,@@ -179,7 +179,7 @@ const fileCaptionSuggestion = (const dateSuggestions = (s: string,locale: string,- holidays: Searchable<DateSearchResult>[],+ holidays: Searchable<LabelledSearchDateComponents>[],): SearchSuggestion[] =>parseDateComponents(s, locale, holidays).map(({ components, label }) => ({type: "date",@@ -204,15 +204,18 @@ const dateSuggestions = (const parseDateComponents = (s: string,locale: string,- holidays: Searchable<DateSearchResult>[],-): DateSearchResult[] =>+ holidays: Searchable<LabelledSearchDateComponents>[],+): LabelledSearchDateComponents[] =>[parseChrono(s, locale),parseYearComponents(s),holidays.filter(searchableIncludes(s)),].flat();-const parseChrono = (s: string, locale: string): DateSearchResult[] =>+const parseChrono = (+ s: string,+ locale: string,+): LabelledSearchDateComponents[] =>chrono.parse(s).map((result) => {@@ -246,7 +249,7 @@ const parseChrono = (s: string, locale: string): DateSearchResult[] =>.filter((x) => x !== undefined);/** chrono does not parse years like "2024", so do it manually. */-const parseYearComponents = (s: string): DateSearchResult[] => {+const parseYearComponents = (s: string): LabelledSearchDateComponents[] => {// s is already trimmed.if (s.length == 4) {const year = parseInt(s);