π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remote expects uniques
Manav Rathib71fa478b96a
diff --git a/web/packages/new/photos/services/collection/index.ts b/web/packages/new/photos/services/collection/index.tsindex 33e602536c..24dc08b430 100644--- a/web/packages/new/photos/services/collection/index.ts+++ b/web/packages/new/photos/services/collection/index.ts@@ -219,12 +219,16 @@ const encryptWithCollectionKey = async ();/**- * Make a remote request to move the given {@link collectionFiles} to trash.+ * Make a remote request to move the given {@link files} to trash.+ *+ * @param files The {@link EnteFile}s to move to trash. The API request needs+ * both a file ID and a collection ID, but there should be at most one entry for+ * a particular fileID in this array.** Does not modify local state.*/-export const moveToTrash = async (collectionFiles: EnteFile[]) => {- for (const batchFiles of batch(collectionFiles, requestBatchSize)) {+export const moveToTrash = async (files: EnteFile[]) => {+ for (const batchFiles of batch(files, requestBatchSize)) {ensureOk(await fetch(await apiURL("/files/trash"), {method: "POST",diff --git a/web/packages/new/photos/services/dedup.ts b/web/packages/new/photos/services/dedup.tsindex f9750f2ac1..5ceed26127 100644--- a/web/packages/new/photos/services/dedup.ts+++ b/web/packages/new/photos/services/dedup.ts@@ -243,11 +243,10 @@ export const removeSelectedDuplicateGroups = async (//const filesToAdd = new Map<number, EnteFile[]>();- let filesToTrash: EnteFile[] = [];+ const filesToTrash: EnteFile[] = [];for (const duplicateGroup of selectedDuplicateGroups) {const retainedItem = duplicateGroupItemToRetain(duplicateGroup);-// Find the existing collection IDs to which this item already belongs.const existingCollectionIDs = new Set(retainedItem.collectionFiles.map((cf) => cf.collectionID),@@ -257,15 +256,15 @@ export const removeSelectedDuplicateGroups = async (// (except the file we're retaining) belongs.const collectionIDs = new Set<number>();for (const item of duplicateGroup.items) {- // Skip the item we're retaining,+ // Skip the item we're retaining.if (item.file.id == retainedItem.file.id) continue;// Determine the collections to which any of the item's files belong.for (const { collectionID } of item.collectionFiles) {if (!existingCollectionIDs.has(collectionID))collectionIDs.add(collectionID);}- // Add the item's files to list of collection files to be trashed.- filesToTrash = filesToTrash.concat(item.collectionFiles);+ // Move the item's file to trash.+ filesToTrash.push(item.file);}// Add the file we're retaining to these (uniqued) collections.