Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move out

Manav Rathi924707fa5649
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 10481b3a84..f6311a5b3f 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -107,6 +107,7 @@ import {
constructEmailList,
constructUserIDToEmailMap,
createAlbum,
+ createUnCategorizedCollection,
getAllLatestCollections,
getAllLocalCollections,
getCollectionSummaries,
@@ -131,6 +132,7 @@ import {
ALL_SECTION,
ARCHIVE_SECTION,
COLLECTION_OPS_TYPE,
+ DUMMY_UNCATEGORIZED_COLLECTION,
HIDDEN_ITEMS_SECTION,
TRASH_SECTION,
constructCollectionNameMap,
@@ -1461,3 +1463,19 @@ const HiddenSectionNavbarContents: React.FC<
</FlexWrapper>
</HorizontalFlex>
);
+
+/**
+ * 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 findCollectionByCreatingUncategorizedIfNeeded = 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/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.ts
index f86f4b0a45..1127b52062 100644
--- a/web/apps/photos/src/utils/collection.ts
+++ b/web/apps/photos/src/utils/collection.ts
@@ -45,8 +45,6 @@ export const DUMMY_UNCATEGORIZED_COLLECTION = -3;
export const HIDDEN_ITEMS_SECTION = -4;
export const ALL_SECTION = 0;
-
-
const SYSTEM_COLLECTION_TYPES = new Set<CollectionSummaryType>([
"all",
"archive",