From b0a3c8a90cd495ab00fd69aca8425087a8f6ff11 Mon Sep 17 00:00:00 2001 From: Nico <32375741+nulmete@users.noreply.github.com> Date: Tue, 17 Mar 2026 12:35:36 -0300 Subject: [PATCH] Save logo URL for dark and light backgrounds during setup (#41823) **Related issue:** Resolves #39082 # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually https://github.com/user-attachments/assets/51ede24f-3317-455a-8995-fd50e9281a47 --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- changes/39082-setup-logo-light-background | 1 + frontend/utilities/helpers.tests.tsx | 47 ++++++++++++++++++++++- frontend/utilities/helpers.tsx | 4 +- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 changes/39082-setup-logo-light-background diff --git a/changes/39082-setup-logo-light-background b/changes/39082-setup-logo-light-background new file mode 100644 index 0000000000..bb3a4362df --- /dev/null +++ b/changes/39082-setup-logo-light-background @@ -0,0 +1 @@ +* Fixed a bug where the organization logo URL entered during setup was only saved for dark backgrounds and not for light backgrounds. diff --git a/frontend/utilities/helpers.tests.tsx b/frontend/utilities/helpers.tests.tsx index f7acfa7944..27e9ceb7d1 100644 --- a/frontend/utilities/helpers.tests.tsx +++ b/frontend/utilities/helpers.tests.tsx @@ -1,5 +1,6 @@ import { getPastDate, getFutureDate } from "test/test-utils"; -import { +import type { IRegistrationFormData } from "interfaces/registration_form_data"; +import helpers, { removeOSPrefix, compareVersions, willExpireWithinXDays, @@ -77,4 +78,48 @@ describe("helpers utilities", () => { expect(willExpireWithinXDays(fiftyDaysAgo, 30)).toEqual(false); }); }); + + describe("setupData function", () => { + it("sets org_logo_url_light_background to the same value as org_logo_url", () => { + const formData: IRegistrationFormData = { + email: "admin@example.com", + name: "Admin", + password: "password123", + password_confirmation: "password123", + org_name: "Fleet", + org_web_url: "", + org_logo_url: "https://example.com/logo.png", + fleet_web_address: "", + server_url: "https://fleet.example.com", + }; + + const result = helpers.setupData(formData); + + expect(result.org_info.org_logo_url).toEqual( + "https://example.com/logo.png" + ); + expect(result.org_info.org_logo_url_light_background).toEqual( + "https://example.com/logo.png" + ); + }); + + it("sets org_logo_url_light_background to empty string when org_logo_url is not provided", () => { + const formData: IRegistrationFormData = { + email: "admin@example.com", + name: "Admin", + password: "password123", + password_confirmation: "password123", + org_name: "Fleet", + org_web_url: "", + org_logo_url: "", + fleet_web_address: "", + server_url: "https://fleet.example.com", + }; + + const result = helpers.setupData(formData); + + expect(result.org_info.org_logo_url).toEqual(""); + expect(result.org_info.org_logo_url_light_background).toEqual(""); + }); + }); }); diff --git a/frontend/utilities/helpers.tsx b/frontend/utilities/helpers.tsx index 3c7044d399..8207cd558b 100644 --- a/frontend/utilities/helpers.tsx +++ b/frontend/utilities/helpers.tsx @@ -56,6 +56,7 @@ import { isPlatformLabelNameFromAPI, } from "utilities/constants"; import { IDropdownOption } from "interfaces/dropdownOption"; +import type { IRegistrationFormData } from "interfaces/registration_form_data"; import CustomLink from "components/CustomLink"; const ORG_INFO_ATTRS = ["org_name", "org_logo_url"]; @@ -517,7 +518,7 @@ export const greyCell = (roleOrTeamText: string): boolean => { ); }; -const setupData = (formData: any) => { +const setupData = (formData: IRegistrationFormData) => { const orgInfo = pick(formData, ORG_INFO_ATTRS); const adminInfo = pick(formData, ADMIN_ATTRS); @@ -525,6 +526,7 @@ const setupData = (formData: any) => { server_url: formData.server_url, org_info: { ...orgInfo, + org_logo_url_light_background: orgInfo.org_logo_url || "", }, admin: { admin: true,