Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(hidden):fixing-modal-closing-issue

Aswin Asoke3ffa726690a
diff --git a/web/apps/photos/src/components/AuthenticateUser.tsx b/web/apps/photos/src/components/AuthenticateUser.tsx
index bf3b3fbc58..9d2c9e2d3a 100644
--- a/web/apps/photos/src/components/AuthenticateUser.tsx
+++ b/web/apps/photos/src/components/AuthenticateUser.tsx
@@ -1,3 +1,5 @@
+import CloseIcon from "@mui/icons-material/Close";
+import { IconButton, Stack, Typography } from "@mui/material";
import { VerifyMasterPasswordForm } from "ente-accounts/components/VerifyMasterPasswordForm";
import { checkSessionValidity } from "ente-accounts/services/session";
import {
@@ -38,7 +40,22 @@ export const AuthenticateUser: React.FC<AuthenticateUserProps> = ({
open={open}
onClose={onClose}
sx={{ position: "absolute" }}
- title={t("password")}
+ title={
+ <Stack
+ direction="row"
+ alignItems="center"
+ justifyContent="space-between"
+ >
+ <Typography variant="h6">{t("password")}</Typography>
+ <IconButton
+ aria-label={t("cancel")}
+ size="small"
+ onClick={onClose}
+ >
+ <CloseIcon fontSize="small" />
+ </IconButton>
+ </Stack>
+ }
>
<AuthenticateUserDialogContents {...{ open, onClose }} {...rest} />
</TitledMiniDialog>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index f4299f1959..85f6d1bbe7 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -258,7 +258,9 @@ const Page: React.FC = () => {
const handleCloseAuthenticateUser = useCallback(() => {
authenticateUserVisibilityProps.onClose();
- authenticateUserResolvers.current.reject?.();
+ authenticateUserResolvers.current.reject?.(
+ new Error("authentication dismissed"),
+ );
resetAuthenticateUserResolvers();
}, [authenticateUserVisibilityProps.onClose]);
@@ -887,13 +889,18 @@ const Page: React.FC = () => {
isHiddenCollectionSummary: boolean | undefined,
) => {
const lastAuthAt = lastAuthenticationForHiddenTimestamp.current;
- if (
- isHiddenCollectionSummary &&
- barMode != "hidden-albums" &&
- Date.now() - lastAuthAt > 5 * 60 * 1e3 /* 5 minutes */
- ) {
- await authenticateUser();
- lastAuthenticationForHiddenTimestamp.current = Date.now();
+ try {
+ if (
+ isHiddenCollectionSummary &&
+ barMode != "hidden-albums" &&
+ Date.now() - lastAuthAt > 5 * 60 * 1e3 /* 5 minutes */
+ ) {
+ await authenticateUser();
+ lastAuthenticationForHiddenTimestamp.current = Date.now();
+ }
+ } catch (e) {
+ log.info("Skipping navigation to hidden section", e);
+ return;
}
handleShowCollectionSummaryWithID(collectionSummaryID);
},