Skip to content

armgit / ente

Public Imported from GitHub
0

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

chore(Upload):adding-comments

Aswin Asok9e7b8b24a5e8
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index 3f9d53bc6e..a7585cacd4 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -597,6 +597,18 @@ export const Upload: React.FC<UploadProps> = ({
uploadManager.showUploadProgressDialog();
};
+ /**
+ *
+ * @param batchResult
+ * @param targetCollection
+ *
+ * This function actually receives the batchResult which is the post-upload
+ * object and the target collection of upload.
+ *
+ * the {@link successfulFilesFromUploadBatchResult} take the batchResult
+ * and then returns an array of files which is of the type {@link EnteFile}
+ * this file is then added to the corresponding shared album.
+ */
const handlePostUploadBatchResult = async (
batchResult: UploadBatchResult,
targetCollection: Collection | undefined,
diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.ts
index 5956dd3b01..df7d1a23b3 100644
--- a/web/apps/photos/src/services/upload-manager.ts
+++ b/web/apps/photos/src/services/upload-manager.ts
@@ -73,6 +73,12 @@ export type FinishedUploads = Map<FileID, FinishedUploadType>;
export type SegregatedFinishedUploads = Map<FinishedUploadType, FileID[]>;
+/**
+ * Earlier we just returned a boolean if the uploads
+ * were completed, we are make it a more verbose one,
+ * and the below two types UploadBatchItemResult and UploadBatchResult
+ * are for facilitating the same.
+ */
export interface UploadBatchItemResult {
localID: number;
requestedCollectionID: number;
@@ -84,6 +90,14 @@ export interface UploadBatchResult {
itemResults: UploadBatchItemResult[];
}
+/**
+ *
+ * @param batchResult
+ * @returns an array of the files which completed the uploads.
+ *
+ * This is an utility function which actaully takes in the batchResult
+ * and tranforms it to an array of files
+ */
export const successfulFilesFromUploadBatchResult = (
batchResult: UploadBatchResult,
) =>
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index 1433d6ef3a..01ce245757 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -1859,6 +1859,13 @@ const stateForUpdatedCollectionFiles = (
const stateByUpdatingFilteredFiles = (state: GalleryState) => {
if (state.isInSearchMode) {
const searchFiles = state.searchResults ?? state.filteredFiles;
+ /**
+ * the suppressSharedFilesSavedByUser is a utlity function added in during the
+ * UploadToSharedAlbum feature implementation.
+ *
+ * This particular function actually filters out any files which are actually
+ * owned by someone else for which the currentUser has a copy.
+ */
const visibleSearchFiles = suppressSharedFilesSavedByUser(
searchFiles,
state.user?.id,