From 8e6b4ef04b5481ba2bd094e1444b3eb94a30f9f2 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Tue, 6 Sep 2022 15:21:23 +0200 Subject: [PATCH 1/2] filter out nulled metadatas in device tile properly --- src/components/views/settings/devices/DeviceTile.tsx | 12 ++++++++---- .../__snapshots__/DevicesPanel-test.tsx.snap | 6 ------ .../__snapshots__/CurrentDeviceSection-test.tsx.snap | 4 ---- .../devices/__snapshots__/DeviceTile-test.tsx.snap | 6 ------ .../__snapshots__/SelectableDeviceTile-test.tsx.snap | 1 - .../__snapshots__/SessionManagerTab-test.tsx.snap | 6 ------ 6 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/components/views/settings/devices/DeviceTile.tsx b/src/components/views/settings/devices/DeviceTile.tsx index 73ee17b2f4a..c9efcaa0c63 100644 --- a/src/components/views/settings/devices/DeviceTile.tsx +++ b/src/components/views/settings/devices/DeviceTile.tsx @@ -93,16 +93,20 @@ const DeviceTile: React.FC = ({ device, children, onClick }) => { id: 'lastSeenIp', value: device.last_seen_ip }, ]; + console.log(metadata); + return
{ metadata.map(({ id, value }, index) => - - { !!index && ' · ' } - - , + !!value + ? + { !!index && ' · ' } + + + : null, ) }
diff --git a/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap b/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap index f0c569a82f1..2f2f3a7773e 100644 --- a/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap +++ b/test/components/views/settings/__snapshots__/DevicesPanel-test.tsx.snap @@ -141,8 +141,6 @@ exports[` renders device panel with devices 1`] = ` > Unverified - · - ·
renders device panel with devices 1`] = ` > Unverified - · - ·
renders device panel with devices 1`] = ` > Unverified - · - ·
renders device and correct security card when > Unverified - · - ·
renders device and correct security card when > Unverified - · - ·
renders a device with no metadata 1`] = ` > Unverified - · - ·
renders a verified device with no metadata 1`] = ` > Unverified - · - ·
renders display name with a tooltip 1`] = ` > Unverified - · - ·
renders unselected device tile with checkbox 1 Unverified · - · diff --git a/test/components/views/settings/tabs/user/__snapshots__/SessionManagerTab-test.tsx.snap b/test/components/views/settings/tabs/user/__snapshots__/SessionManagerTab-test.tsx.snap index 468556195fc..4fab1d48d34 100644 --- a/test/components/views/settings/tabs/user/__snapshots__/SessionManagerTab-test.tsx.snap +++ b/test/components/views/settings/tabs/user/__snapshots__/SessionManagerTab-test.tsx.snap @@ -83,8 +83,6 @@ exports[` renders current session section with a verified s > Verified - · - ·
renders current session section with an unverifie > Unverified - · - ·
sets device verification status correctly 1`] = ` > Verified - · - ·
Date: Tue, 6 Sep 2022 15:22:47 +0200 Subject: [PATCH 2/2] remove log --- src/components/views/settings/devices/DeviceTile.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/views/settings/devices/DeviceTile.tsx b/src/components/views/settings/devices/DeviceTile.tsx index c9efcaa0c63..a23e1586db4 100644 --- a/src/components/views/settings/devices/DeviceTile.tsx +++ b/src/components/views/settings/devices/DeviceTile.tsx @@ -93,8 +93,6 @@ const DeviceTile: React.FC = ({ device, children, onClick }) => { id: 'lastSeenIp', value: device.last_seen_ip }, ]; - console.log(metadata); - return