Skip to content

Commit 9ebe0a2

Browse files
committed
Fix JSON issues
1 parent 5c3e757 commit 9ebe0a2

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

sentry/issue_alerts.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type IssueAlert struct {
2424
CreatedBy *IssueAlertCreatedBy `json:"createdBy,omitempty"`
2525
Environment *string `json:"environment,omitempty"`
2626
Projects []string `json:"projects,omitempty"`
27-
TaskUUID *string `json:"-"` // This is actually the UUID of the async task that can be spawned to create the rule
27+
TaskUUID *string `json:"uuid",omitempty` // This is actually the UUID of the async task that can be spawned to create the rule
2828
}
2929

3030
// IssueAlertCreatedBy for defining the rule creator.
@@ -103,9 +103,15 @@ func (s *IssueAlertsService) Create(ctx context.Context, organizationSlug string
103103
return nil, resp, errors.New("missing task uuid")
104104
}
105105
// We just received a reference to an async task, we need to check another endpoint to retrieve the issue alert we created
106-
return s.getIssueAlertFromTaskDetail(ctx, organizationSlug, projectSlug, *alert.TaskUUID)
106+
alert, resp, err := s.getIssueAlertFromTaskDetail(ctx, organizationSlug, projectSlug, *alert.TaskUUID)
107+
if err != nil {
108+
return nil, resp, err
109+
}
110+
alert.TaskUUID = nil
111+
return alert, resp, nil
107112
}
108113

114+
alert.TaskUUID = nil
109115
return alert, resp, nil
110116
}
111117

sentry/metric_alerts.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,15 @@ func (s *MetricAlertsService) Create(ctx context.Context, organizationSlug strin
124124
return nil, resp, errors.New("missing task uuid")
125125
}
126126
// We just received a reference to an async task, we need to check another endpoint to retrieve the metric alert we created
127-
return s.getMetricAlertFromMetricAlertTaskDetail(ctx, organizationSlug, projectSlug, *alert.TaskUUID)
127+
alert, resp, err := s.getMetricAlertFromMetricAlertTaskDetail(ctx, organizationSlug, projectSlug, *alert.TaskUUID)
128+
if err != nil {
129+
return nil, resp, err
130+
}
131+
alert.TaskUUID = nil
132+
return alert, resp, nil
128133
}
129134

135+
alert.TaskUUID = nil
130136
return alert, resp, nil
131137
}
132138

0 commit comments

Comments
 (0)