diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.ts index 6bc2b0fc3d..98f270b51f 100644 --- a/web/apps/photos/src/utils/collection.ts +++ b/web/apps/photos/src/utils/collection.ts @@ -160,14 +160,6 @@ async function createCollectionDownloadFolder( return collectionDownloadPath; } -export const getUserOwnedCollections = (collections: Collection[]) => { - const user: User = getData("user"); - if (!user?.id) { - throw Error("user missing"); - } - return collections.filter((collection) => collection.owner.id === user.id); -}; - const isQuickLinkCollection = (collection: Collection) => collection.magicMetadata?.data.subType == CollectionSubType.quicklink; diff --git a/web/apps/photos/src/utils/file/index.ts b/web/apps/photos/src/utils/file/index.ts index 48354d8d7f..bc7fa52883 100644 --- a/web/apps/photos/src/utils/file/index.ts +++ b/web/apps/photos/src/utils/file/index.ts @@ -32,28 +32,18 @@ import { SetFilesDownloadProgressAttributesCreator, } from "types/gallery"; -function getSelectedFileIds(selectedFiles: SelectedState) { - const filesIDs: number[] = []; - for (const [key, val] of Object.entries(selectedFiles)) { - if (typeof val == "boolean" && val) { - filesIDs.push(Number(key)); - } - } - return new Set(filesIDs); -} export function getSelectedFiles( selected: SelectedState, files: EnteFile[], ): EnteFile[] { - const selectedFilesIDs = getSelectedFileIds(selected); - return files.filter((file) => selectedFilesIDs.has(file.id)); -} - -export function isSharedFile(user: User, file: EnteFile) { - if (!user?.id || !file?.ownerID) { - return false; + const selectedFilesIDs = new Set(); + for (const [key, val] of Object.entries(selected)) { + if (typeof val == "boolean" && val) { + selectedFilesIDs.add(Number(key)); + } } - return file.ownerID !== user.id; + + return files.filter((file) => selectedFilesIDs.has(file.id)); } export async function getFileFromURL(fileURL: string, name: string) {