Skip to content

armgit / ente

Public Imported from GitHub
0

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

Shorten

Manav Rathi69ccf7d3c90a
diff --git a/web/packages/new/photos/services/collection/index.ts b/web/packages/new/photos/services/collection/index.ts
index 5e21366d1c..d51e90ca56 100644
--- a/web/packages/new/photos/services/collection/index.ts
+++ b/web/packages/new/photos/services/collection/index.ts
@@ -60,7 +60,6 @@ export const isHiddenCollection = (collection: Collection) =>
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
collection.magicMetadata?.data.visibility === ItemVisibility.hidden;
-// TODO: Does this need localizations?
export const DEFAULT_HIDDEN_COLLECTION_USER_FACING_NAME = "Hidden";
/**
@@ -79,10 +78,5 @@ export const getCollectionUserFacingName = (collection: Collection) => {
/**
* Return a map of the (user-facing) collection name, indexed by collection ID.
*/
-export const createCollectionNameByID = (allCollections: Collection[]) =>
- new Map<number, string>(
- allCollections.map((collection) => [
- collection.id,
- getCollectionUserFacingName(collection),
- ]),
- );
+export const createCollectionNameByID = (collections: Collection[]) =>
+ new Map(collections.map((c) => [c.id, getCollectionUserFacingName(c)]));
diff --git a/web/packages/new/photos/services/dedup.ts b/web/packages/new/photos/services/dedup.ts
index 27f807ecf7..6bede82f46 100644
--- a/web/packages/new/photos/services/dedup.ts
+++ b/web/packages/new/photos/services/dedup.ts
@@ -1,5 +1,5 @@
import type { EnteFile } from "@/media/file";
-import { getLocalCollections } from "./collection";
+import { createCollectionNameByID, getLocalCollections } from "./collection";
import { getLocalFiles, uniqueFilesByID } from "./files";
/**
@@ -83,10 +83,7 @@ export const deduceDuplicates = async () => {
filesByHash.set(hash, [...(filesByHash.get(hash) ?? []), file]);
}
- const collections = await getLocalCollections();
- const collectionNameByID = new Map<number, string>();
- for (const collection of collections)
- collectionNameByID.set(collection.id, collection.name);
+ const collectionNameByID = createCollectionNameByID(await getLocalCollections());
const duplicateGroups: DuplicateGroup[] = [];