From a44f93a14cf86506ecb8460642ba4601568e76b4 Mon Sep 17 00:00:00 2001 From: liugq Date: Fri, 4 Aug 2023 18:35:22 +0800 Subject: [PATCH] update retrieve channel logic --- service/alerting/common/helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/alerting/common/helper.go b/service/alerting/common/helper.go index faf5e344..ecb8d5ed 100644 --- a/service/alerting/common/helper.go +++ b/service/alerting/common/helper.go @@ -77,7 +77,7 @@ func RetrieveChannel(ch *alerting.Channel) (*alerting.Channel, error) { return nil, fmt.Errorf("empty channel") } enabled := ch.Enabled - if ch.ID != "" { + if ch.ID != "" && ((ch.Email == nil && ch.Type == alerting.ChannelEmail) || (ch.Webhook == nil && ch.Type == alerting.ChannelWebhook)) { _, err := orm.Get(ch) if err != nil { return nil, err