Skip to content

Commit 4c26c55

Browse files
committed
fix(api): minor change to how pause alert was done
1 parent 46bab0b commit 4c26c55

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func Register(r *macaron.Macaron) {
252252

253253
r.Group("/alerts", func() {
254254
r.Post("/test", bind(dtos.AlertTestCommand{}), wrap(AlertTest))
255-
r.Post("/:alertId/pause", ValidateOrgAlert, bind(dtos.PauseAlertCommand{}), wrap(PauseAlert))
255+
r.Post("/:alertId/pause", bind(dtos.PauseAlertCommand{}), wrap(PauseAlert))
256256
r.Get("/:alertId", ValidateOrgAlert, wrap(GetAlert))
257257
r.Get("/", wrap(GetAlerts))
258258
r.Get("/states-for-dashboard", wrap(GetAlertStatesForDashboard))

pkg/services/sqlstore/alert.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ func PauseAlertRule(cmd *m.PauseAlertCommand) error {
248248
return inTransaction(func(sess *xorm.Session) error {
249249
alert := m.Alert{}
250250

251-
if has, err := sess.Id(cmd.AlertId).Get(&alert); err != nil {
251+
has, err := x.Where("id = ? AND org_id=?", cmd.AlertId, cmd.OrgId).Get(&alert)
252+
253+
if err != nil {
252254
return err
253255
} else if !has {
254256
return fmt.Errorf("Could not find alert")

0 commit comments

Comments
 (0)