From 6b1f63efc92113bcd99a4ac927cb96f4014a6a8c Mon Sep 17 00:00:00 2001 From: rainzm Date: Fri, 19 Mar 2021 11:02:32 +0800 Subject: [PATCH] fix(notify): be compatible with robots and webhooks --- pkg/notify/models/notification.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/notify/models/notification.go b/pkg/notify/models/notification.go index 5a27b65c56..8e3b8d74dc 100644 --- a/pkg/notify/models/notification.go +++ b/pkg/notify/models/notification.go @@ -87,6 +87,9 @@ func (nm *SNotificationManager) ValidateCreateData(ctx context.Context, userCred if !userCred.IsAllow(rbacutils.ScopeSystem, api.SERVICE_TYPE, nm.KeywordPlural(), policy.PolicyActionPerform, SendByContact) { return input, httperrors.NewForbiddenError("can't send notification by contact, need receiver") } + if len(input.Contacts) == 0 { + input.Contacts = []string{""} + } } // check contact type enabled