mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
use notification state id instead of notifier id
This commit is contained in:
@@ -74,7 +74,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := &m.SetAlertNotificationStateToCompleteCommand{
|
cmd := &m.SetAlertNotificationStateToCompleteCommand{
|
||||||
Id: notifier.GetNotifierId(),
|
Id: notifierState.state.Id,
|
||||||
Version: notifierState.state.Version,
|
Version: notifierState.state.Version,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
|
|||||||
func (n *notificationService) sendNotification(evalContext *EvalContext, notifierState *notifierState) error {
|
func (n *notificationService) sendNotification(evalContext *EvalContext, notifierState *notifierState) error {
|
||||||
if !evalContext.IsTestRun {
|
if !evalContext.IsTestRun {
|
||||||
setPendingCmd := &m.SetAlertNotificationStateToPendingCommand{
|
setPendingCmd := &m.SetAlertNotificationStateToPendingCommand{
|
||||||
Id: notifierState.state.NotifierId,
|
Id: notifierState.state.Id,
|
||||||
Version: notifierState.state.Version,
|
Version: notifierState.state.Version,
|
||||||
AlertRuleStateUpdatedVersion: evalContext.Rule.StateChanges,
|
AlertRuleStateUpdatedVersion: evalContext.Rule.StateChanges,
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi
|
|||||||
for _, notifierState := range notifierStates {
|
for _, notifierState := range notifierStates {
|
||||||
err := n.sendNotification(evalContext, notifierState)
|
err := n.sendNotification(evalContext, notifierState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
n.log.Error("failed to send notification", "id", notifierState.notifier.GetNotifierId())
|
n.log.Error("failed to send notification", "id", notifierState.notifier.GetNotifierId(), "error", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -238,7 +238,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SetAlertNotificationStateToCompleteCommand(ctx context.Context, cmd *m.SetAlertNotificationStateToCompleteCommand) error {
|
func SetAlertNotificationStateToCompleteCommand(ctx context.Context, cmd *m.SetAlertNotificationStateToCompleteCommand) error {
|
||||||
return withDbSession(ctx, func(sess *DBSession) error {
|
return inTransactionCtx(ctx, func(sess *DBSession) error {
|
||||||
version := cmd.Version
|
version := cmd.Version
|
||||||
var current m.AlertNotificationState
|
var current m.AlertNotificationState
|
||||||
sess.ID(cmd.Id).Get(¤t)
|
sess.ID(cmd.Id).Get(¤t)
|
||||||
|
Reference in New Issue
Block a user