This commit is contained in:
Manav Rathi
2025-06-30 15:23:40 +05:30
parent 0c6cc8f7a1
commit 7d8fb296af
2 changed files with 7 additions and 25 deletions

View File

@@ -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;

View File

@@ -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<number>();
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) {