Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Fix active sessions action from ctrl-k and improve session display

Anand Baburajan46b7e616a2a7
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index a559324835..58f0b698d2 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -202,6 +202,7 @@ type AccountAction = Extract<
| "account.changePassword"
| "account.changeEmail"
| "account.deleteAccount"
+ | "account.sessions"
>;
type PreferencesAction = Extract<
@@ -973,6 +974,11 @@ const Account: React.FC<AccountProps> = ({
await openAccountsManagePasskeysPage();
}, [onRootClose]);
+ const handleActiveSessions = useCallback(async () => {
+ await onAuthenticateUser();
+ showSessions();
+ }, [onAuthenticateUser, showSessions]);
+
useEffect(() => {
if (!open || !pendingAction) return;
switch (pendingAction) {
@@ -995,9 +1001,13 @@ const Account: React.FC<AccountProps> = ({
case "account.deleteAccount":
showDeleteAccount();
break;
+ case "account.sessions":
+ void handleActiveSessions();
+ break;
}
onActionHandled?.();
}, [
+ handleActiveSessions,
handleChangeEmail,
handleChangePassword,
handlePasskeys,
@@ -1009,11 +1019,6 @@ const Account: React.FC<AccountProps> = ({
showTwoFactor,
]);
- const handleActiveSessions = async () => {
- await onAuthenticateUser();
- showSessions();
- };
-
return (
<TitledNestedSidebarDrawer
{...{ open, onClose }}
diff --git a/web/packages/new/photos/components/sidebar/SessionsSettings.tsx b/web/packages/new/photos/components/sidebar/SessionsSettings.tsx
index b144759f5c..93bb060c61 100644
--- a/web/packages/new/photos/components/sidebar/SessionsSettings.tsx
+++ b/web/packages/new/photos/components/sidebar/SessionsSettings.tsx
@@ -2,6 +2,7 @@ import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import DevicesIcon from "@mui/icons-material/Devices";
import RefreshIcon from "@mui/icons-material/Refresh";
import {
+ Box,
CircularProgress,
Divider,
IconButton,
@@ -117,9 +118,13 @@ const SessionsSettingsContents: React.FC<SessionsSettingsContentsProps> = ({
showMiniDialog({
title: t("terminate_session"),
- message: isCurrentDevice
- ? t("terminate_session_confirm_message_self")
- : `${t("terminate_session_confirm_message")}: ${session.prettyUA}`,
+ message: isCurrentDevice ? (
+ t("terminate_session_confirm_message_self")
+ ) : (
+ <Box sx={{ whiteSpace: "pre-line" }}>
+ {`${t("terminate_session_confirm_message")}:\n\n${session.prettyUA}\n${session.ip}`}
+ </Box>
+ ),
continue: {
text: t("terminate"),
color: "critical",
@@ -257,7 +262,9 @@ const SessionRow: React.FC<SessionRowProps> = ({
variant="small"
sx={{ color: "text.muted" }}
>
- {session.ip}
+ {session.ip.length > 28
+ ? `${session.ip.slice(0, 28)}…`
+ : session.ip}
</Typography>
)}
<Typography