π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
skip non user owned collection files during export
Abhinavf6d3a995204d
diff --git a/apps/photos/src/services/export/index.ts b/apps/photos/src/services/export/index.tsindex daf5eb3718..661a8f6db0 100644--- a/apps/photos/src/services/export/index.ts+++ b/apps/photos/src/services/export/index.ts@@ -234,7 +234,18 @@ class ExportService {try {const user: User = getData(LS_KEYS.USER);const files = await getAllLocalFiles();- const userPersonalFiles = getPersonalFiles(files, user);+ const collections = await getAllLocalCollections();+ const collectionIdToOwnerIDMap = new Map<number, number>(+ collections.map((collection) => [+ collection.id,+ collection.owner.id,+ ])+ );+ const userPersonalFiles = getPersonalFiles(+ files,+ collectionIdToOwnerIDMap,+ user+ );const unExportedFiles = getUnExportedFiles(userPersonalFiles,@@ -347,9 +358,19 @@ class ExportService {try {const user: User = getData(LS_KEYS.USER);const files = mergeMetadata(await getAllLocalFiles());- const personalFiles = getPersonalFiles(files, user);-const collections = await getAllLocalCollections();+ const collectionIdToOwnerIDMap = new Map<number, number>(+ collections.map((collection) => [+ collection.id,+ collection.owner.id,+ ])+ );+ const personalFiles = getPersonalFiles(+ files,+ collectionIdToOwnerIDMap,+ user+ );+const nonEmptyPersonalCollections = getNonEmptyPersonalCollections(collections,personalFiles,diff --git a/apps/photos/src/utils/file/index.ts b/apps/photos/src/utils/file/index.tsindex fdfa167c9c..f258220a8d 100644--- a/apps/photos/src/utils/file/index.ts+++ b/apps/photos/src/utils/file/index.ts@@ -823,11 +823,19 @@ export function getLatestVersionFiles(files: EnteFile[]) {);}-export function getPersonalFiles(files: EnteFile[], user: User) {+export function getPersonalFiles(+ files: EnteFile[],+ collectionIdToOwnerIDMap: Map<number, number>,+ user: User+) {if (!user?.id) {throw Error('user missing');}- return files.filter((file) => file.ownerID === user.id);+ return files.filter(+ (file) =>+ file.ownerID === user.id &&+ collectionIdToOwnerIDMap.get(file.collectionID) === user.id+ );}export function getIDBasedSortedFiles(files: EnteFile[]) {