From 12e3ba8e5ac883b329f851f134501399637fa94a Mon Sep 17 00:00:00 2001 From: Faye Duxovni Date: Fri, 23 Sep 2022 09:21:04 -0400 Subject: [PATCH] Make device ID copyable in device list (#9297) --- .../views/settings/devices/DeviceTile.tsx | 15 +----- .../__snapshots__/DevicesPanel-test.tsx.snap | 18 +++++++ .../CurrentDeviceSection-test.tsx.snap | 12 +++++ .../__snapshots__/DeviceTile-test.tsx.snap | 36 ++++++++++--- .../SelectableDeviceTile-test.tsx.snap | 18 ++++--- .../SessionManagerTab-test.tsx.snap | 54 ++++++++++--------- 6 files changed, 100 insertions(+), 53 deletions(-) diff --git a/src/components/views/settings/devices/DeviceTile.tsx b/src/components/views/settings/devices/DeviceTile.tsx index a23e1586db..e48070ddbc 100644 --- a/src/components/views/settings/devices/DeviceTile.tsx +++ b/src/components/views/settings/devices/DeviceTile.tsx @@ -19,8 +19,6 @@ import React, { Fragment } from "react"; import { Icon as InactiveIcon } from '../../../../../res/img/element-icons/settings/inactive.svg'; import { _t } from "../../../../languageHandler"; import { formatDate, formatRelativeTime } from "../../../../DateUtils"; -import TooltipTarget from "../../elements/TooltipTarget"; -import { Alignment } from "../../elements/Tooltip"; import Heading from "../../typography/Heading"; import { INACTIVE_DEVICE_AGE_DAYS, isDeviceInactive } from "./filter"; import { DeviceWithVerification } from "./types"; @@ -32,18 +30,8 @@ export interface DeviceTileProps { } const DeviceTileName: React.FC<{ device: DeviceWithVerification }> = ({ device }) => { - if (device.display_name) { - return - - { device.display_name } - - ; - } return - { device.device_id } + { device.display_name || device.device_id } ; }; @@ -91,6 +79,7 @@ const DeviceTile: React.FC = ({ device, children, onClick }) => { id: 'isVerified', value: verificationStatus }, { id: 'lastActivity', value: lastActivity }, { id: 'lastSeenIp', value: device.last_seen_ip }, + { id: 'deviceId', value: device.device_id }, ]; return
diff --git a/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap b/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap index 2f2f3a7773..0cdead4e6e 100644 --- a/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap +++ b/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap @@ -141,6 +141,12 @@ exports[` renders device panel with devices 1`] = ` > Unverified + · + + device_1 +
renders device panel with devices 1`] = ` > Unverified + · + + device_2 +
renders device panel with devices 1`] = ` > Unverified + · + + device_3 +
renders device and correct security card when > Unverified + · + + alices_device +
renders device and correct security card when > Unverified + · + + alices_device +
renders a device with no metadata 1`] = ` > Unverified + · + + 123 +
renders a verified device with no metadata 1`] = ` > Unverified + · + + 123 +
renders display name with a tooltip 1`] = `
-
-

- My device -

-
+ My device +
separates metadata with a dot 1`] = ` > 1.2.3.4 + · + + 123 +
renders unselected device tile with checkbox 1
-
-

- My Device -

-
+ My Device +
renders current session section with a verified s
-
-

- Alices device -

-
+ Alices device +
renders current session section with an unverifie
-
-

- Alices device -

-
+ Alices device +
sets device verification status correctly 1`] = `
-
-

- Alices device -

-
+ Alices device +