Skip to content

armgit / ente

Public Imported from GitHub
0

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

fin 1

Manav Rathi3263542f5ee3
diff --git a/web/packages/new/photos/services/dedup.ts b/web/packages/new/photos/services/dedup.ts
index baf84f79d9..b5bd842a62 100644
--- a/web/packages/new/photos/services/dedup.ts
+++ b/web/packages/new/photos/services/dedup.ts
@@ -13,9 +13,13 @@ export interface DuplicateGroup {
* These are sorted by the collectionName.
*/
items: {
- /** The underlying collection file. */
+ /**
+ * The underlying collection file.
+ */
file: EnteFile;
- /** The name of the collection to which this file belongs. */
+ /**
+ * The name of the collection to which this file belongs.
+ */
collectionName: string;
}[];
/**
@@ -97,13 +101,23 @@ export const deduceDuplicates = async () => {
const duplicates = potentialDuplicates.filter(
(file) => file.info?.fileSize == size,
);
- if (duplicates.length < 2) continue;
+ const items = duplicates
+ .map((file) => {
+ const collectionName = collectionNameByID.get(
+ file.collectionID,
+ );
+ return collectionName ? { file, collectionName } : undefined;
+ })
+ .filter((item) => !!item);
+ if (items.length < 2) continue;
duplicateGroups.push({
- items: duplicates.map((file) => ({ file, collectionName: "TODO" })),
+ items,
itemSize: size,
prunableCount: duplicates.length - 1,
prunableSize: size * (duplicates.length - 1),
isSelected: true,
});
}
+
+ return duplicateGroups;
};