Skip to content

armgit / ente

Public Imported from GitHub
0

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

Progress

Manav Rathi1ac2d60c7bd6
diff --git a/web/packages/new/photos/services/dedup.ts b/web/packages/new/photos/services/dedup.ts
index 391d28f709..c0d08c9357 100644
--- a/web/packages/new/photos/services/dedup.ts
+++ b/web/packages/new/photos/services/dedup.ts
@@ -192,28 +192,38 @@ export const deduceDuplicates = async () => {
*
* This function will only process entries for which isSelected is `true`.
*
+ * @param onRemoveDuplicateGroup A function that is called each time a duplicate
+ * group is successfully removed. The duplicate group that was removed is passed
+ * as an argument to it.
+ *
* @returns true if all selected duplicate groups were successfully removed, and
* false if there were any errors.
*/
export const removeSelectedDuplicateGroups = async (
duplicateGroups: DuplicateGroup[],
+ onRemoveDuplicateGroup: (g: DuplicateGroup) => void,
) => {
const selectedDuplicateGroups = duplicateGroups.filter((g) => g.isSelected);
let allSuccess = true;
for (const duplicateGroup of selectedDuplicateGroups) {
try {
- const fileToRetain = duplicateGroupFileToRetain(duplicateGroup);
- console.log({ fileToRetain });
+ await removeDuplicateGroup(duplicateGroup);
+ onRemoveDuplicateGroup(duplicateGroup);
} catch (e) {
log.warn("Failed to remove duplicate group", e);
allSuccess = false;
}
}
- // TODO: Remove me after testing the UI
- await wait(3000);
return allSuccess;
};
+const removeDuplicateGroup = async (duplicateGroup: DuplicateGroup) => {
+ const fileToRetain = duplicateGroupFileToRetain(duplicateGroup);
+ console.log({ fileToRetain });
+ // TODO: Remove me after testing the UI
+ await wait(1000);
+};
+
/**
* Find the most eligible file from amongst the duplicates to retain.
*