π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move
Manav Rathicc54faf78a30
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 15a6c6bb93..6065ce591c 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -61,6 +61,7 @@ import {import {constructUserIDToEmailMap,createShareeSuggestionEmails,+ findCollectionCreatingUncategorizedIfNeeded,validateKey,} from "ente-new/photos/components/gallery/helpers";import {@@ -70,12 +71,7 @@ import {import { useIsOffline } from "ente-new/photos/components/utils/use-is-offline";import { usePeopleStateSnapshot } from "ente-new/photos/components/utils/use-snapshot";import { shouldShowWhatsNew } from "ente-new/photos/services/changelog";-import {- ALL_SECTION,- createAlbum,- createUncategorizedCollection,- DUMMY_UNCATEGORIZED_COLLECTION,-} from "ente-new/photos/services/collection";+import { ALL_SECTION, createAlbum } from "ente-new/photos/services/collection";import { areOnlySystemCollections } from "ente-new/photos/services/collection-summary";import { getAllLocalCollections } from "ente-new/photos/services/collections";import exportService from "ente-new/photos/services/export";@@ -927,10 +923,12 @@ const Page: React.FC = () => {attributes={collectionSelectorAttributes}collectionSummaries={normalCollectionSummaries}collectionForCollectionID={(id) =>+ // Null assert since the collection selector should only+ // show selectable normalCollectionSummaries.findCollectionCreatingUncategorizedIfNeeded(normalCollections,id,- )+ )!}/><FilesDownloadProgress@@ -1334,19 +1332,3 @@ export async function handleSubscriptionCompletionRedirectIfNeeded(}}}--/**- * Return the {@link Collection} (from amongst {@link collections}) with the- * given {@link collectionID}. As a special case, if collection ID is the- * placeholder ID of the uncategorized collection, create it and then return it.- */-const findCollectionCreatingUncategorizedIfNeeded = async (- collections: Collection[],- collectionID: number,-) => {- if (collectionID == DUMMY_UNCATEGORIZED_COLLECTION) {- return await createUncategorizedCollection();- } else {- return collections.find((c) => c.id === collectionID);- }-};diff --git a/web/packages/new/photos/components/CollectionSelector.tsx b/web/packages/new/photos/components/CollectionSelector.tsxindex 7323b91c3e..84bf4bf871 100644--- a/web/packages/new/photos/components/CollectionSelector.tsx+++ b/web/packages/new/photos/components/CollectionSelector.tsx@@ -73,11 +73,13 @@ type CollectionSelectorProps = ModalVisibilityProps & {*/collectionSummaries: CollectionSummaries;/**- * A function to map from a collection ID to a {@link Collection}.+ * A function to map from a collection or pseudo-collection ID to a+ * {@link Collection}.** This is invoked when the user makes a selection, to convert the ID of the- * selected collection into a collection object that can be passed to the- * {@link callback} attribute of {@link CollectionSelectorAttributes}.+ * selected collection, which can be a pseudo-collection too, into a+ * collection object that can be passed to the {@link callback} attribute of+ * {@link CollectionSelectorAttributes}.*/collectionForCollectionID: (collectionID: number) => Promise<Collection>;};diff --git a/web/packages/new/photos/components/gallery/helpers.ts b/web/packages/new/photos/components/gallery/helpers.tsindex e76aaa5056..d47b28a960 100644--- a/web/packages/new/photos/components/gallery/helpers.ts+++ b/web/packages/new/photos/components/gallery/helpers.ts@@ -15,6 +15,8 @@ import type { User } from "ente-accounts/services/user";import log from "ente-base/log";import type { Collection } from "ente-media/collection";import type { FamilyData } from "ente-new/photos/services/user-details";+import { createUncategorizedCollection } from "../../services/collection";+import { CollectionSummaryID } from "../../services/collection-summary";/*** Ensure that the keys in local storage are not malformed by verifying that the@@ -36,6 +38,20 @@ export const validateKey = async () => {}};+/**+ * Return the {@link Collection} (from amongst {@link collections}) with the+ * given {@link collectionID}. As a special case, if collection ID is the ID of+ * the placeholder uncategorized collection, create a new uncategorized+ * collection and then return it.+ */+export const findCollectionCreatingUncategorizedIfNeeded = async (+ collections: Collection[],+ collectionID: number,+): Promise<Collection | undefined> =>+ collectionID == CollectionSummaryID.uncategorizedPlaceholder+ ? createUncategorizedCollection()+ : collections.find(({ id }) => id == collectionID);+export const constructUserIDToEmailMap = (user: User,collections: Collection[],