Skip to content

Commit 604a22e

Browse files
fix(crons): Correct owner field (#68920)
This doesn't come back as a string, it's an Actor
1 parent f29fcd4 commit 604a22e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

fixtures/js-stubs/monitor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
ScheduleType,
66
} from 'sentry/views/monitors/types';
77

8+
import {ActorFixture} from './actor';
89
import {ProjectFixture} from './project';
9-
import {UserFixture} from './user';
1010

1111
export function MonitorFixture(params: Partial<Monitor> = {}): Monitor {
1212
return {
@@ -16,7 +16,7 @@ export function MonitorFixture(params: Partial<Monitor> = {}): Monitor {
1616
project: ProjectFixture(),
1717
slug: 'my-monitor',
1818
status: 'active',
19-
owner: `user:${UserFixture().id}`,
19+
owner: ActorFixture(),
2020
type: MonitorType.CRON_JOB,
2121
config: {
2222
checkin_margin: 5,

static/app/views/monitors/components/monitorForm.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ function MonitorForm({
215215
target => `${RULES_SELECTOR_MAP[target.targetType]}:${target.targetIdentifier}`
216216
);
217217

218+
const owner = monitor?.owner ? `${monitor.owner.type}:${monitor.owner.id}` : null;
219+
218220
const envOptions = selectedProject?.environments.map(e => ({value: e, label: e})) ?? [];
219221
const alertRuleEnvs = [
220222
{
@@ -239,7 +241,7 @@ function MonitorForm({
239241
? {
240242
name: monitor.name,
241243
slug: monitor.slug,
242-
owner: monitor.owner,
244+
owner: owner,
243245
type: monitor.type ?? DEFAULT_MONITOR_TYPE,
244246
project: monitor.project.slug,
245247
'alertRule.targets': alertRuleTarget,

static/app/views/monitors/types.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {ObjectStatus, Project} from 'sentry/types';
1+
import type {Actor, ObjectStatus, Project} from 'sentry/types';
22
import type {ColorOrAlias} from 'sentry/utils/theme';
33

44
export enum MonitorType {
@@ -121,7 +121,7 @@ export interface Monitor {
121121
id: string;
122122
isMuted: boolean;
123123
name: string;
124-
owner: string;
124+
owner: Actor;
125125
project: Project;
126126
slug: string;
127127
status: ObjectStatus;

0 commit comments

Comments
 (0)