Chore: Remove bus from alerting rule (#47508) (#47510)

* Chore: Remove bus from alerting rule

* fix alerting tests

* fix provide service

(cherry picked from commit b31c7d3654)

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-04-12 14:05:00 +02:00
committed by GitHub
co-authored by Serge Zaitsev
parent be0d1a8d57
commit cce492b246
11 changed files with 28 additions and 21 deletions
+1 -2
View File
@@ -9,7 +9,6 @@ import (
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/alerting"
"github.com/grafana/grafana/pkg/services/guardian"
@@ -491,7 +490,7 @@ func (hs *HTTPServer) NotificationTest(c *models.ReqContext) response.Response {
SecureSettings: dto.SecureSettings,
}
if err := bus.Dispatch(c.Req.Context(), cmd); err != nil {
if err := hs.AlertNotificationService.HandleNotificationTestCommand(c.Req.Context(), cmd); err != nil {
if errors.Is(err, models.ErrSmtpNotEnabled) {
return response.Error(412, err.Error(), err)
}