mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
fix: check the activity type before trying to add fleet (#24434)
> Related issue: #24337 # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [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/Committing-Changes.md#changes-files) for more information. - [x] Added/updated tests - [x] Manual QA for all new/changed functionality
This commit is contained in:
parent
55781815bb
commit
a5c667a882
5 changed files with 52 additions and 6 deletions
1
changes/24337-fix-activity
Normal file
1
changes/24337-fix-activity
Normal file
|
|
@ -0,0 +1 @@
|
|||
- Fixes a bug that would add "Fleet" to activities where it shouldn't be
|
||||
|
|
@ -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(<ActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
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(<ActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
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(<ActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
expect(screen.getByText(/Fleet/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = ({
|
|||
<div>
|
||||
{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";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue