Merge pull request #10460 from rainzm/notify/robot1

fix(notify): be compatible with robots and webhooks
This commit is contained in:
Zexi Li
2021-03-22 10:44:20 +08:00
committed by GitHub
+3
View File
@@ -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