Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Rename

Manav Rathi58e2b8ab529b
diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.ts
index 1d9574e413..6f8ce1b21b 100644
--- a/web/apps/photos/src/utils/collection.ts
+++ b/web/apps/photos/src/utils/collection.ts
@@ -5,15 +5,15 @@ import log from "ente-base/log";
import { type Collection, CollectionSubType } from "ente-media/collection";
import { EnteFile } from "ente-media/file";
import {
- DEFAULT_HIDDEN_COLLECTION_USER_FACING_NAME,
- HIDDEN_ITEMS_SECTION,
addToCollection,
+ createAlbum,
+ defaultHiddenCollectionUserFacingName,
findDefaultHiddenCollectionIDs,
+ HIDDEN_ITEMS_SECTION,
isHiddenCollection,
isIncomingShare,
moveToCollection,
restoreToCollection,
- createAlbum,
} from "ente-new/photos/services/collection";
import {
getAllLocalCollections,
@@ -112,13 +112,13 @@ export async function downloadDefaultHiddenCollectionHelper(
);
const setFilesDownloadProgressAttributes =
setFilesDownloadProgressAttributesCreator(
- DEFAULT_HIDDEN_COLLECTION_USER_FACING_NAME,
+ defaultHiddenCollectionUserFacingName,
HIDDEN_ITEMS_SECTION,
true,
);
await downloadCollectionFiles(
- DEFAULT_HIDDEN_COLLECTION_USER_FACING_NAME,
+ defaultHiddenCollectionUserFacingName,
defaultHiddenCollectionFiles,
setFilesDownloadProgressAttributes,
);
diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.ts
index 53af58da8a..2e0b080256 100644
--- a/web/packages/new/photos/services/collection.ts
+++ b/web/packages/new/photos/services/collection.ts
@@ -47,6 +47,7 @@ const requestBatchSize = 1000;
const uncategorizedCollectionName = "Uncategorized";
const defaultHiddenCollectionName = ".hidden";
+export const defaultHiddenCollectionUserFacingName = "Hidden";
const favoritesCollectionName = "Favorites";
export const ARCHIVE_SECTION = -1;
@@ -55,20 +56,16 @@ export const DUMMY_UNCATEGORIZED_COLLECTION = -3;
export const HIDDEN_ITEMS_SECTION = -4;
export const ALL_SECTION = 0;
-export const DEFAULT_HIDDEN_COLLECTION_USER_FACING_NAME = "Hidden";
-
/**
* Return the "user facing" name of the given collection.
*
* Usually this is the same as the collection name, but it might be a different
* string for special collections like default hidden collections.
*/
-export const getCollectionUserFacingName = (collection: Collection) => {
- if (isDefaultHiddenCollection(collection)) {
- return DEFAULT_HIDDEN_COLLECTION_USER_FACING_NAME;
- }
- return collection.name;
-};
+export const collectionUserFacingName = (collection: Collection) =>
+ isDefaultHiddenCollection(collection)
+ ? defaultHiddenCollectionUserFacingName
+ : collection.name;
/**
* Create a new album (a collection of type "album") on remote, and return its
@@ -269,7 +266,7 @@ export const getCollectionChanges = async (
* Return a map of the (user-facing) collection name, indexed by collection ID.
*/
export const createCollectionNameByID = (collections: Collection[]) =>
- new Map(collections.map((c) => [c.id, getCollectionUserFacingName(c)]));
+ new Map(collections.map((c) => [c.id, collectionUserFacingName(c)]));
/**
* A CollectionFileItem represents a file in a API request to add, move or
diff --git a/web/packages/new/photos/services/export.ts b/web/packages/new/photos/services/export.ts
index 2c5ac352bb..b5a4f8d010 100644
--- a/web/packages/new/photos/services/export.ts
+++ b/web/packages/new/photos/services/export.ts
@@ -20,8 +20,8 @@ import { fileLocation, type Metadata } from "ente-media/file-metadata";
import { FileType } from "ente-media/file-type";
import { decodeLivePhoto } from "ente-media/live-photo";
import {
+ collectionUserFacingName,
createCollectionNameByID,
- getCollectionUserFacingName,
} from "ente-new/photos/services/collection";
import { getAllLocalCollections } from "ente-new/photos/services/collections";
import { getAllLocalFiles } from "ente-new/photos/services/files";
@@ -504,7 +504,7 @@ class ExportService {
);
const newCollectionExportName = await safeDirectoryName(
exportFolder,
- getCollectionUserFacingName(collection),
+ collectionUserFacingName(collection),
fs.exists,
);
log.info(
@@ -1271,8 +1271,7 @@ const getRenamedExportedCollections = (
collection.id,
);
- const collectionExportName =
- getCollectionUserFacingName(collection);
+ const collectionExportName = collectionUserFacingName(collection);
if (currentExportName === collectionExportName) {
return false;