From 6514631dcd462935eb95cff4e775000b007cb05a Mon Sep 17 00:00:00 2001
From: jacobshandling <61553566+jacobshandling@users.noreply.github.com>
Date: Thu, 5 Dec 2024 15:38:35 -0800
Subject: [PATCH] UI - Only include custom sourced emails that are present
(#24411)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Addresses #24321
Note that the "Used by" section includes the Google chrome user and the
custom user that has an associated email, but ignores the custom user
with no email:
- [x] Changes file added for user-visible changes in `changes/`,
- [x] Manual QA for all new/changed functionality
---------
Co-authored-by: Jacob Shandling
---
changes/24321-exclude-custom-source-without-email | 2 ++
frontend/interfaces/host.ts | 5 ++++-
.../pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx | 1 -
3 files changed, 6 insertions(+), 2 deletions(-)
create mode 100644 changes/24321-exclude-custom-source-without-email
diff --git a/changes/24321-exclude-custom-source-without-email b/changes/24321-exclude-custom-source-without-email
new file mode 100644
index 0000000000..f0c33e9c38
--- /dev/null
+++ b/changes/24321-exclude-custom-source-without-email
@@ -0,0 +1,2 @@
+- Exclude any custom sourced "users" from the host details "used by" display if Fleet doesn't have
+ an email for them.
diff --git a/frontend/interfaces/host.ts b/frontend/interfaces/host.ts
index 762dc5b76e..c0a9f0cab5 100644
--- a/frontend/interfaces/host.ts
+++ b/frontend/interfaces/host.ts
@@ -119,7 +119,10 @@ export const mapDeviceUsersForDisplay = (
idpUser = d;
break;
case "custom":
- customUser = d;
+ // exclude custom user without email
+ if (d.email) {
+ customUser = d;
+ }
break;
default:
newDeviceMapping.push(getDeviceUserForDisplay(d));
diff --git a/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx b/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx
index 8947a18cf4..8e46f71971 100644
--- a/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx
+++ b/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx
@@ -39,7 +39,6 @@ import {
IQueryKeyQueriesLoadAll,
ISchedulableQuery,
} from "interfaces/schedulable_query";
-import { IHostScript } from "interfaces/script";
import {
normalizeEmptyValues,