π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[photos] Remove comments added with shared dedup
AswinAsok5a84e704b012
diff --git a/rust/crates/photos/src/dedup.rs b/rust/crates/photos/src/dedup.rsindex b5a84f9fd1..f79ffbd3dd 100644--- a/rust/crates/photos/src/dedup.rs+++ b/rust/crates/photos/src/dedup.rs@@ -5,7 +5,6 @@ pub struct Collection {pub owner_id: i64,}-// Hashes must be normalized, including `image:video` for legacy Live Photos.pub struct File {pub id: i64,pub collection_id: i64,@@ -23,12 +22,9 @@ pub struct Item {#[derive(Debug, PartialEq, Eq)]pub struct Group {pub items: Vec<Item>,- // Live Photo ZIP sizes can vary despite matching hashes, so use the first- // known nonzero size to estimate savings.pub item_size: u64,}-// The caller must exclude hidden collections. Results preserve input order.pub fn find_duplicates(user_id: i64, collections: &[Collection], files: &[File]) -> Vec<Group> {let allowed: HashSet<_> = collections.iter()@@ -92,7 +88,6 @@ pub struct Addition {#[derive(Debug, Default, PartialEq, Eq)]pub struct RemovalPlan {- // Complete every album addition successfully before trashing any files.pub additions: Vec<Addition>,pub trash_ids: Vec<i64>,}@@ -113,8 +108,6 @@ pub fn plan_removal(groups: &[Vec<Duplicate>]) -> RemovalPlan {}).or_else(|| {items.iter().find(|item| {- // Match editedName ?? editedTime: an explicitly empty name- // takes precedence over an edited timestamp.item.edited_name.as_ref().map_or_else(|| item.edited_time.is_some_and(|time| time != 0),|name| !name.is_empty(),@@ -330,8 +323,6 @@ mod tests {#[test]fn detection_and_removal_preserve_every_album_membership_combination() {let collections: Vec<_> = (11..=13).map(|id| Collection { id, owner_id: 1 }).collect();- // Each of three distinct copies can belong to any nonempty subset of- // three albums. Applying the plan must leave one copy in every album.for first in 1..8 {for second in 1..8 {for third in 1..8 {diff --git a/web/apps/photos/src/services/dedup.ts b/web/apps/photos/src/services/dedup.tsindex f7bb7c092b..7fac57b866 100644--- a/web/apps/photos/src/services/dedup.ts+++ b/web/apps/photos/src/services/dedup.ts@@ -120,7 +120,6 @@ export const removeSelectedDuplicateGroups = async (const collections = await savedNormalCollections();const collectionsByID = new Map(collections.map((c) => [c.id, c]));- // Complete every album addition before trashing any duplicates.for (const { collectionId, fileIds } of plan.additions) {await addToCollection(collectionsByID.get(collectionId)!,diff --git a/web/apps/photos/tests/dedup.test.ts b/web/apps/photos/tests/dedup.test.tsindex da47d8555c..3d2942394e 100644--- a/web/apps/photos/tests/dedup.test.ts+++ b/web/apps/photos/tests/dedup.test.ts@@ -90,7 +90,6 @@ describe("deduceDuplicates through Rust WASM", () => {isSelected: true,},]);- // The locale-sorted first item is the fallback retained copy in Rust.await removeSelectedDuplicateGroups(groups, vi.fn(), vi.fn());expect(addToCollection).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ id: 11 }),@@ -177,7 +176,6 @@ describe("removeSelectedDuplicateGroups", () => {async (caption) => {const group = duplicateGroup();const retained = group.items[1]!.file;- // Cached records bypass the metadata schema and can predate normalization.Object.assign(retained.pubMagicMetadata!.data, { caption });const refresh = vi.fn();