mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Hangouts: fixes notifications for alerts with empty message (#23559)
* Hangouts: fixes notifications for alerts with empty message * Update pkg/services/alerting/notifiers/googlechat.go Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com> Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
parent
aaab636bf4
commit
2661054fe8
@ -126,13 +126,15 @@ func (gcn *GoogleChatNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
gcn.log.Error("evalContext returned an invalid rule URL")
|
||||
}
|
||||
|
||||
// add a text paragraph widget for the message
|
||||
widgets := []widget{
|
||||
textParagraphWidget{
|
||||
widgets := []widget{}
|
||||
if len(evalContext.Rule.Message) > 0 {
|
||||
// add a text paragraph widget for the message if there is a message
|
||||
// Google Chat API doesn't accept an empty text property
|
||||
widgets = append(widgets, textParagraphWidget{
|
||||
Text: text{
|
||||
Text: evalContext.Rule.Message,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// add a text paragraph widget for the fields
|
||||
|
Loading…
Reference in New Issue
Block a user