π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Make optional
Manav Rathi1bd15a83657e
diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.tsindex d7a72f111f..f74992d7ce 100644--- a/web/apps/photos/src/services/collectionService.ts+++ b/web/apps/photos/src/services/collectionService.ts@@ -1003,7 +1003,7 @@ export const sortCollectionSummaries = (compareCollectionsLatestFile(b.latestFile, a.latestFile));case "updation-time-desc":- return b.updationTime - a.updationTime;+ return (b.updationTime ?? 0) - (a.updationTime ?? 0);}}).sort((a, b) => b.order ?? 0 - a.order ?? 0)diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex 72867b277f..a552ab48bc 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -22,7 +22,6 @@ import {TRASH_SECTION,} from "../../services/collection";import type {- CollectionSummaries,CollectionSummary,CollectionSummaryType,} from "../../services/collection/ui";@@ -487,10 +486,16 @@ export const deriveCollectionSummaries = (files,);- collectionSummaries.set(- ALL_SECTION,- getAllSectionSummary(files, archivedCollectionIDs),+ const allSectionFiles = findAllSectionVisibleFiles(+ files,+ archivedCollectionIDs,);+ collectionSummaries.set(ALL_SECTION, {+ id: ALL_SECTION,+ type: "all",+ name: t("section_all"),+ ...pseudoCollectionOptionsForFiles(allSectionFiles),+ });collectionSummaries.set(TRASH_SECTION,getTrashedCollectionSummary(trashedFiles),@@ -500,6 +505,13 @@ export const deriveCollectionSummaries = (return collectionSummaries;};+const pseudoCollectionOptionsForFiles = (files: EnteFile[]) => ({+ coverFile: files[0],+ latestFile: files[0],+ fileCount: files.length,+ updationTime: files[0]?.updationTime,+});+/*** Helper function to compute hidden collection summaries from their* dependencies.@@ -676,16 +688,6 @@ const isSharedOnlyViaLink = (collection: Collection) =>// eslint-disable-next-line @typescript-eslint/no-unnecessary-conditioncollection.publicURLs?.length && !collection.sharees?.length;-function getSectionSummaries(- files: EnteFile[],- trashedFiles: EnteFile[],- archivedCollections: Set<number>,-): CollectionSummaries {- const collectionSummaries: CollectionSummaries = new Map();-- return collectionSummaries;-}-function getArchivedSectionSummary(files: EnteFile[]): CollectionSummary {const archivedFiles = uniqueFilesByID(files.filter((file) => isArchivedFile(file)),@@ -716,54 +718,20 @@ function getArchivedSectionSummary(files: EnteFile[]): CollectionSummary {};}-function getAllSectionSummary(- files: EnteFile[],- archivedCollections: Set<number>,-): CollectionSummary {- const allSectionFiles = getAllSectionVisibleFiles(- files,- archivedCollections,- );- return {- id: ALL_SECTION,- name: t("section_all"),- type: "all",- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition- coverFile: allSectionFiles?.[0],- // See: [Note: strict mode migration]- //- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition- latestFile: allSectionFiles?.[0],- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition- fileCount: allSectionFiles?.length || 0,- // See: [Note: strict mode migration]- //- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition- updationTime: allSectionFiles?.[0]?.updationTime,- };-}--function getAllSectionVisibleFiles(+/**+ * Return all list of files that should be shown in the "All" section.+ */+const findAllSectionVisibleFiles = (files: EnteFile[],- archivedCollections: Set<number>,-): EnteFile[] {- const allSectionVisibleFiles = uniqueFilesByID(- files.filter((file) => {- if (- isArchivedFile(file) ||- archivedCollections.has(file.collectionID)- ) {- return false;- }- return true;- }),+ archivedCollectionIDs: Set<number>,+) =>+ uniqueFilesByID(+ files.filter(+ (file) =>+ !isArchivedFile(file) &&+ !archivedCollectionIDs.has(file.collectionID),+ ),);- return allSectionVisibleFiles;-}function getTrashedCollectionSummary(trashedFiles: EnteFile[],diff --git a/web/packages/new/photos/services/collection/ui.ts b/web/packages/new/photos/services/collection/ui.tsindex ac3efb4497..3a56e94ed5 100644--- a/web/packages/new/photos/services/collection/ui.ts+++ b/web/packages/new/photos/services/collection/ui.ts@@ -62,7 +62,12 @@ export interface CollectionSummary {* that belong to this pseudo-collection.*/fileCount: number;- updationTime: number;+ /**+ * The time when the collection was last updated. For pseudo-collections+ * this will (usually) be the updation time of the latest file that it+ * contains.+ */+ updationTime: number | undefined;order?: number;}