Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photos):limit-description-confirmation-to-info-close

Aswin Asok7c395b588bda
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index c329ac38d4..5a466189a7 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -202,30 +202,26 @@ export const FileInfo: React.FC<FileInfoProps> = ({
};
}, [file, open]);
- const confirmDiscardCaption = (action: () => void) => {
+ const handleClose = () => {
if (captionEditState == "saving") return;
if (captionEditState == "unsaved") {
showMiniDialog({
title: t("discard_changes"),
message: t("discard_changes_confirm_message"),
- continue: { text: t("discard"), color: "critical", action },
+ continue: {
+ text: t("discard"),
+ color: "critical",
+ action: onClose,
+ },
});
return;
}
- action();
+ onClose();
};
- const handleClose = () => confirmDiscardCaption(onClose);
-
- const handleSelectCollection = (collectionID: number) =>
- confirmDiscardCaption(() => onSelectCollection?.(collectionID));
-
- const handleSelectPerson = (personID: string) =>
- confirmDiscardCaption(() => onSelectPerson?.(personID));
-
const handleSelectFace = ({ personID, faceID }: AnnotatedFaceID) => {
log.info(`Selected person ${personID} for faceID ${faceID}`);
- handleSelectPerson(personID);
+ onSelectPerson?.(personID);
};
const handleAddPerson = async (personID: string) => {
@@ -397,11 +393,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
annotatedFaceIDs={annotatedFaces}
onSelectFace={handleSelectFace}
manuallyAssignedPeople={manuallyAssignedPeople}
- onSelectPerson={
- onSelectPerson
- ? handleSelectPerson
- : undefined
- }
+ onSelectPerson={onSelectPerson}
onAddPerson={
canAddPerson ? showAssignPerson : undefined
}
@@ -420,7 +412,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
fileCollectionIDs,
collectionNameByID,
hiddenCollectionIDs,
- onSelectCollection: handleSelectCollection,
+ onSelectCollection,
}}
/>
)}