mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix: Alerting Notification channel http api fixes (#16288)
Fix so that uid can be changed when updating notification channels through the http api. Update documentation
This commit is contained in:
committed by
Torkel Ödegaard
parent
bfba47c6c4
commit
79b86466fd
@@ -317,6 +317,10 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
|
||||
current.SendReminder = cmd.SendReminder
|
||||
current.DisableResolveMessage = cmd.DisableResolveMessage
|
||||
|
||||
if cmd.Uid != "" {
|
||||
current.Uid = cmd.Uid
|
||||
}
|
||||
|
||||
if current.SendReminder {
|
||||
if cmd.Frequency == "" {
|
||||
return m.ErrNotificationFrequencyNotFound
|
||||
@@ -356,8 +360,13 @@ func UpdateAlertNotificationWithUid(cmd *m.UpdateAlertNotificationWithUidCommand
|
||||
return fmt.Errorf("Cannot update, alert notification uid %s doesn't exist", cmd.Uid)
|
||||
}
|
||||
|
||||
if cmd.NewUid == "" {
|
||||
cmd.NewUid = cmd.Uid
|
||||
}
|
||||
|
||||
updateNotification := &m.UpdateAlertNotificationCommand{
|
||||
Id: current.Id,
|
||||
Uid: cmd.NewUid,
|
||||
Name: cmd.Name,
|
||||
Type: cmd.Type,
|
||||
SendReminder: cmd.SendReminder,
|
||||
|
Reference in New Issue
Block a user