diff --git a/changes/16649-ui-activity-disk-encryption b/changes/16649-ui-activity-disk-encryption new file mode 100644 index 0000000000..5ca2a0e06a --- /dev/null +++ b/changes/16649-ui-activity-disk-encryption @@ -0,0 +1 @@ +- Updated UI text for disk encryption activities to reflect cross-platform functionality. \ No newline at end of file diff --git a/frontend/interfaces/activity.ts b/frontend/interfaces/activity.ts index bc6a91e8cc..d1c3e5fd67 100644 --- a/frontend/interfaces/activity.ts +++ b/frontend/interfaces/activity.ts @@ -42,7 +42,13 @@ export enum ActivityType { CreatedWindowsProfile = "created_windows_profile", DeletedWindowsProfile = "deleted_windows_profile", EditedWindowsProfile = "edited_windows_profile", + // Note: Both "enabled_disk_encryption" and "enabled_macos_disk_encryption" display the same + // message. The latter is deprecated in the API but it is retained here for backwards compatibility. + EnabledDiskEncryption = "enabled_disk_encryption", EnabledMacDiskEncryption = "enabled_macos_disk_encryption", + // Note: Both "disabled_disk_encryption" and "disabled_macos_disk_encryption" display the same + // message. The latter is deprecated in the API but it is retained here for backwards compatibility. + DisabledDiskEncryption = "disabled_disk_encryption", DisabledMacDiskEncryption = "disabled_macos_disk_encryption", AddedBootstrapPackage = "added_bootstrap_package", DeletedBootstrapPackage = "deleted_bootstrap_package", diff --git a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx index 799930e375..a18dd1aae7 100644 --- a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx +++ b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx @@ -547,16 +547,53 @@ describe("Activity Feed", () => { expect(forAllTeams).toBeNull(); }); + it("renders an 'enabled_disk_encryption' type activity for a team", () => { + const activity = createMockActivity({ + type: ActivityType.EnabledDiskEncryption, + details: { team_name: "Alphas" }, + }); + render(); + + expect( + screen.getByText("enforced disk encryption for hosts assigned to the", { + exact: false, + }) + ).toBeInTheDocument(); + expect(screen.getByText("Alphas")).toBeInTheDocument(); + expect(screen.getByText(" team.", { exact: false })).toBeInTheDocument(); + const withNoTeams = screen.queryByText("with no team"); + expect(withNoTeams).toBeNull(); + }); + it("renders an 'enabled_macos_disk_encryption' type activity for a team", () => { + // Test deprecated activity type const activity = createMockActivity({ type: ActivityType.EnabledMacDiskEncryption, details: { team_name: "Alphas" }, }); render(); + expect( + screen.getByText("enforced disk encryption for hosts assigned to the", { + exact: false, + }) + ).toBeInTheDocument(); + expect(screen.getByText("Alphas")).toBeInTheDocument(); + expect(screen.getByText(" team.", { exact: false })).toBeInTheDocument(); + const withNoTeams = screen.queryByText("with no team"); + expect(withNoTeams).toBeNull(); + }); + + it("renders a 'disabled_disk_encryption' type activity for a team", () => { + const activity = createMockActivity({ + type: ActivityType.DisabledMacDiskEncryption, + details: { team_name: "Alphas" }, + }); + render(); + expect( screen.getByText( - "enforced disk encryption for macOS hosts assigned to the", + "removed disk encryption enforcement for hosts assigned to the", { exact: false, } @@ -569,15 +606,16 @@ describe("Activity Feed", () => { }); it("renders a 'disabled_macos_disk_encryption' type activity for a team", () => { + // Test deprecated activity type const activity = createMockActivity({ - type: ActivityType.DisabledMacDiskEncryption, + type: ActivityType.DisabledDiskEncryption, details: { team_name: "Alphas" }, }); render(); expect( screen.getByText( - "removed disk encryption enforcement for macOS hosts assigned to the", + "removed disk encryption enforcement for hosts assigned to the", { exact: false, } @@ -589,7 +627,21 @@ describe("Activity Feed", () => { expect(withNoTeams).toBeNull(); }); + it("renders an 'enabled_disk_encryption' type activity for hosts with no team.", () => { + const activity = createMockActivity({ + type: ActivityType.EnabledDiskEncryption, + details: {}, + }); + render(); + + expect( + screen.getByText("enforced disk encryption for hosts with no team.") + ).toBeInTheDocument(); + expect(screen.queryByText("assigned to the")).toBeNull(); + }); + it("renders an 'enabled_macos_disk_encryption' type activity for hosts with no team.", () => { + // Test deprecated activity type const activity = createMockActivity({ type: ActivityType.EnabledMacDiskEncryption, details: {}, @@ -597,12 +649,31 @@ describe("Activity Feed", () => { render(); expect( - screen.getByText("enforced disk encryption for macOS hosts with no team.") + screen.getByText("enforced disk encryption for hosts with no team.") + ).toBeInTheDocument(); + expect(screen.queryByText("assigned to the")).toBeNull(); + }); + + it("renders a 'disabled_disk_encryption' type activity for hosts with no team.", () => { + const activity = createMockActivity({ + type: ActivityType.DisabledDiskEncryption, + details: {}, + }); + render(); + + expect( + screen.getByText( + "removed disk encryption enforcement for hosts with no team.", + { + exact: false, + } + ) ).toBeInTheDocument(); expect(screen.queryByText("assigned to the")).toBeNull(); }); it("renders a 'disabled_macos_disk_encryption' type activity for hosts with no team.", () => { + // Test deprecated activity type const activity = createMockActivity({ type: ActivityType.DisabledMacDiskEncryption, details: {}, @@ -611,7 +682,7 @@ describe("Activity Feed", () => { expect( screen.getByText( - "removed disk encryption enforcement for macOS hosts with no team.", + "removed disk encryption enforcement for hosts with no team.", { exact: false, } diff --git a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx index 6b8ab46aca..c6b68c57f9 100644 --- a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx +++ b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx @@ -457,13 +457,13 @@ const TAGGED_TEMPLATES = { ); }, - enableMacDiskEncryption: (activity: IActivity) => { + enabledDiskEncryption: (activity: IActivity) => { const suffix = getDiskEncryptionMessageSuffix(activity.details?.team_name); - return <> enforced disk encryption for macOS hosts {suffix}.; + return <> enforced disk encryption for hosts {suffix}.; }, - disableMacDiskEncryption: (activity: IActivity) => { + disabledEncryption: (activity: IActivity) => { const suffix = getDiskEncryptionMessageSuffix(activity.details?.team_name); - return <>removed disk encryption enforcement for macOS hosts {suffix}.; + return <>removed disk encryption enforcement for hosts {suffix}.; }, changedMacOSSetupAssistant: (activity: IActivity) => { return getMacOSSetupAssistantMessage( @@ -819,11 +819,17 @@ const getDetail = ( case ActivityType.EditedWindowsProfile: { return TAGGED_TEMPLATES.editWindowsProfile(activity, isPremiumTier); } + // Note: Both "enabled_disk_encryption" and "enabled_macos_disk_encryption" display the same + // message. The latter is deprecated in the API but it is retained here for backwards compatibility. + case ActivityType.EnabledDiskEncryption: case ActivityType.EnabledMacDiskEncryption: { - return TAGGED_TEMPLATES.enableMacDiskEncryption(activity); + return TAGGED_TEMPLATES.enabledDiskEncryption(activity); } + // Note: Both "disabled_disk_encryption" and "disabled_macos_disk_encryption" display the same + // message. The latter is deprecated in the API but it is retained here for backwards compatibility. + case ActivityType.DisabledDiskEncryption: case ActivityType.DisabledMacDiskEncryption: { - return TAGGED_TEMPLATES.disableMacDiskEncryption(activity); + return TAGGED_TEMPLATES.disabledEncryption(activity); } case ActivityType.AddedBootstrapPackage: { return TAGGED_TEMPLATES.addedMDMBootstrapPackage(activity);