update retrieve channel logic

This commit is contained in:
liugq 2023-08-04 18:35:22 +08:00
parent 24072cd0a1
commit a44f93a14c
1 changed files with 1 additions and 1 deletions

View File

@ -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