Browse Source

Merge branch 'main' into cities

Vishnu Mohandas 1 year ago
parent
commit
12b68b9f2c

+ 1 - 1
apps/photos/src/components/Upload/Uploader.tsx

@@ -391,7 +391,7 @@ export default function Uploader(props: Props) {
     ) => {
     ) => {
         try {
         try {
             addLogLine(
             addLogLine(
-                `upload file to an existing collection - "${collection.name}"`
+                `upload file to an existing collection name:${collection.name}, collectionID:${collection.id}`
             );
             );
             await preCollectionCreationAction();
             await preCollectionCreationAction();
             const filesWithCollectionToUpload: FileWithCollection[] =
             const filesWithCollectionToUpload: FileWithCollection[] =

+ 9 - 2
apps/photos/src/utils/collection/index.ts

@@ -52,6 +52,7 @@ import {
 } from 'utils/export';
 } from 'utils/export';
 import exportService from 'services/export';
 import exportService from 'services/export';
 import { CollectionDownloadProgressAttributes } from 'components/Collections/CollectionDownloadProgress';
 import { CollectionDownloadProgressAttributes } from 'components/Collections/CollectionDownloadProgress';
+import { addLogLine } from '@ente/shared/logging';
 
 
 export enum COLLECTION_OPS_TYPE {
 export enum COLLECTION_OPS_TYPE {
     ADD,
     ADD,
@@ -521,7 +522,8 @@ export function isValidReplacementAlbum(
     return (
     return (
         collection.name === wantedCollectionName &&
         collection.name === wantedCollectionName &&
         (collection.type === CollectionType.album ||
         (collection.type === CollectionType.album ||
-            collection.type === CollectionType.folder) &&
+            collection.type === CollectionType.folder ||
+            collection.type === CollectionType.uncategorized) &&
         !isHiddenCollection(collection) &&
         !isHiddenCollection(collection) &&
         !isQuickLinkCollection(collection) &&
         !isQuickLinkCollection(collection) &&
         !isIncomingShare(collection, user)
         !isIncomingShare(collection, user)
@@ -610,8 +612,13 @@ export const getOrCreateAlbum = async (
     }
     }
     for (const collection of existingCollections) {
     for (const collection of existingCollections) {
         if (isValidReplacementAlbum(collection, user, albumName)) {
         if (isValidReplacementAlbum(collection, user, albumName)) {
+            addLogLine(
+                `Found existing album ${albumName} with id ${collection.id}`
+            );
             return collection;
             return collection;
         }
         }
     }
     }
-    return createAlbum(albumName);
+    const album = await createAlbum(albumName);
+    addLogLine(`Created new album ${albumName} with id ${album.id}`);
+    return album;
 };
 };