π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
refractor(Gallary):simplified-data-flow-added-guard
Aswin Asok5d8a9c47a027
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsxindex 0133661a17..945c9c6105 100644--- a/web/apps/photos/src/components/FileListWithViewer.tsx+++ b/web/apps/photos/src/components/FileListWithViewer.tsx@@ -55,7 +55,7 @@ export type FileListWithViewerProps = {onAddFileToCollection?: (file: EnteFile,- context: { sourceCollectionSummaryID?: number },+ sourceCollectionSummaryID?: number,) => void;} & Pick<FileListProps,diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 983cb3f52b..2df4eb319a 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -175,7 +175,7 @@ const Page: React.FC = () => {* a target collection).*/const pendingSingleFileAdd = useRef<- { file: EnteFile; sourceCollectionID?: number } | undefined+ { file: EnteFile; sourceCollectionSummaryID?: number } | undefined>(undefined);/*** A queue to serialize calls to {@link remoteFilesPull}.@@ -729,7 +729,7 @@ const Page: React.FC = () => {"add",collection,[pendingSingleFileAdd.current.file],- pendingSingleFileAdd.current.sourceCollectionID,+ pendingSingleFileAdd.current.sourceCollectionSummaryID,);}@@ -1016,10 +1016,7 @@ const Page: React.FC = () => {*/const handleAddSingleFileToCollection = useCallback((file: EnteFile, sourceCollectionSummaryID?: number) => {- pendingSingleFileAdd.current = {- file,- sourceCollectionID: sourceCollectionSummaryID,- };+ pendingSingleFileAdd.current = { file, sourceCollectionSummaryID };const handleSelect = async (collection: Collection) => {try {@@ -1285,12 +1282,7 @@ const Page: React.FC = () => {onVisualFeedback={handleVisualFeedback}onSelectCollection={handleSelectCollection}onSelectPerson={handleSelectPerson}- onAddFileToCollection={(file) =>- handleAddSingleFileToCollection(- file,- activeCollectionID,- )- }+ onAddFileToCollection={handleAddSingleFileToCollection}/>)}<Export {...exportVisibilityProps} {...{ collectionNameByID }} />@@ -1303,6 +1295,13 @@ const Page: React.FC = () => {title={t("new_album")}label={t("album_name")}submitButtonTitle={t("create")}+ onClose={() => {+ // If the user dismisses the album name dialog without+ // submitting, clear any pending single-file add so that it+ // doesn't leak into a future album creation.+ pendingSingleFileAdd.current = undefined;+ albumNameInputVisibilityProps.onClose();+ }}onSubmit={handleAlbumNameSubmit}/></FullScreenDropZone>diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex 74c192e5de..720e5bdf11 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -284,7 +284,7 @@ export type FileViewerProps = ModalVisibilityProps & {onAddFileToCollection?: (file: EnteFile,- context: { sourceCollectionSummaryID?: number },+ sourceCollectionSummaryID?: number,) => void;/*** The ID of the currently active collection, if any (e.g., when viewing an album).@@ -488,9 +488,10 @@ export const FileViewer: React.FC<FileViewerProps> = ({const sourceSummaryID = fileNormalCollectionIDs?.get(activeAnnotatedFile.file.id)?.find((id) => id === activeCollectionID);- onAddFileToCollection(activeAnnotatedFile.file, {- sourceCollectionSummaryID: sourceSummaryID,- });+ onAddFileToCollection(+ activeAnnotatedFile.file,+ sourceSummaryID,+ );};}, [onAddFileToCollection,@@ -966,14 +967,15 @@ export const FileViewer: React.FC<FileViewerProps> = ({)}</MoreMenuItem>)}- {handleAddFileToCollection && (- <MoreMenuItem onClick={handleAddFileToCollection}>- <MoreMenuItemTitle>- {t("add_to_album")}- </MoreMenuItemTitle>- <AddIcon />- </MoreMenuItem>- )}+ {handleAddFileToCollection &&+ activeAnnotatedFile.annotation.isOwnFile && (+ <MoreMenuItem onClick={handleAddFileToCollection}>+ <MoreMenuItemTitle>+ {t("add_to_album")}+ </MoreMenuItemTitle>+ <AddIcon />+ </MoreMenuItem>+ )}{canCopyImage() && (<MoreMenuItem onClick={handleCopyImage}><MoreMenuItemTitle>