diff --git a/changes/24337-fix-activity b/changes/24337-fix-activity
new file mode 100644
index 0000000000..c29ac7c72e
--- /dev/null
+++ b/changes/24337-fix-activity
@@ -0,0 +1 @@
+- Fixes a bug that would add "Fleet" to activities where it shouldn't be
\ No newline at end of file
diff --git a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx
index 962618de42..4e5263ea3d 100644
--- a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx
+++ b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tests.tsx
@@ -1412,4 +1412,40 @@ describe("Activity Feed", () => {
)
).toBeInTheDocument();
});
+
+ it("renders setup experience installed software correctly", () => {
+ const activity = createMockActivity({
+ type: ActivityType.InstalledSoftware,
+ actor_full_name: "",
+ actor_email: "",
+ actor_id: undefined,
+ });
+ render();
+
+ expect(screen.getByText(/Fleet/)).toBeInTheDocument();
+ });
+
+ it("renders setup experience ran script correctly", () => {
+ const activity = createMockActivity({
+ type: ActivityType.RanScript,
+ actor_full_name: "",
+ actor_email: "",
+ actor_id: undefined,
+ });
+ render();
+
+ expect(screen.getByText(/Fleet/)).toBeInTheDocument();
+ });
+
+ it("renders setup experience installed VPP app correctly", () => {
+ const activity = createMockActivity({
+ type: ActivityType.RanScript,
+ actor_full_name: "",
+ actor_email: "",
+ actor_id: undefined,
+ });
+ render();
+
+ expect(screen.getByText(/Fleet/)).toBeInTheDocument();
+ });
});
diff --git a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx
index 5e724059bf..e02f7466df 100644
--- a/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx
+++ b/frontend/pages/DashboardPage/cards/ActivityFeed/ActivityItem/ActivityItem.tsx
@@ -1411,10 +1411,14 @@ const ActivityItem = ({
? addGravatarUrlToResource({ email: actor_email })
: { gravatar_url: DEFAULT_GRAVATAR_LINK };
+ // Add the "Fleet" name to the activity if needed.
+ // TODO: remove/refactor this once we have "fleet-initiated" activities.
if (
!activity.actor_email &&
!activity.actor_full_name &&
- !activity.actor_id
+ (activity.type === ActivityType.InstalledSoftware ||
+ activity.type === ActivityType.InstalledAppStoreApp ||
+ activity.type === ActivityType.RanScript)
) {
activity.actor_full_name = "Fleet";
}
diff --git a/frontend/pages/hosts/details/cards/Activity/PastActivityFeed/PastActivityFeed.tsx b/frontend/pages/hosts/details/cards/Activity/PastActivityFeed/PastActivityFeed.tsx
index 4236790d05..89b038eb95 100644
--- a/frontend/pages/hosts/details/cards/Activity/PastActivityFeed/PastActivityFeed.tsx
+++ b/frontend/pages/hosts/details/cards/Activity/PastActivityFeed/PastActivityFeed.tsx
@@ -1,6 +1,6 @@
import React from "react";
-import { IHostPastActivity } from "interfaces/activity";
+import { ActivityType, IHostPastActivity } from "interfaces/activity";
import { IHostPastActivitiesResponse } from "services/entities/activities";
// @ts-ignore
@@ -59,7 +59,9 @@ const PastActivityFeed = ({
if (
!activity.actor_email &&
!activity.actor_full_name &&
- !activity.actor_id
+ (activity.type === ActivityType.InstalledSoftware ||
+ activity.type === ActivityType.InstalledAppStoreApp ||
+ activity.type === ActivityType.RanScript)
) {
activity.actor_full_name = "Fleet";
}
diff --git a/frontend/pages/hosts/details/cards/Activity/UpcomingActivityFeed/UpcomingActivityFeed.tsx b/frontend/pages/hosts/details/cards/Activity/UpcomingActivityFeed/UpcomingActivityFeed.tsx
index f5cf24ec4a..320cd632ec 100644
--- a/frontend/pages/hosts/details/cards/Activity/UpcomingActivityFeed/UpcomingActivityFeed.tsx
+++ b/frontend/pages/hosts/details/cards/Activity/UpcomingActivityFeed/UpcomingActivityFeed.tsx
@@ -1,6 +1,6 @@
import React from "react";
-import { IHostUpcomingActivity } from "interfaces/activity";
+import { ActivityType, IHostUpcomingActivity } from "interfaces/activity";
import { IHostUpcomingActivitiesResponse } from "services/entities/activities";
// @ts-ignore
@@ -54,11 +54,14 @@ const UpcomingActivityFeed = ({
{activitiesList.map((activity: IHostUpcomingActivity) => {
// TODO: remove this once we have a proper way of handling "Fleet-initiated" activities in
- // the backend. For now, if all these fields are empty, then we assume it was Fleet-initiated.
+ // the backend. For now, if all these fields are empty, then we assume it was
+ // Fleet-initiated.
if (
!activity.actor_email &&
!activity.actor_full_name &&
- !activity.actor_id
+ (activity.type === ActivityType.InstalledSoftware ||
+ activity.type === ActivityType.InstalledAppStoreApp ||
+ activity.type === ActivityType.RanScript)
) {
activity.actor_full_name = "Fleet";
}