fix(notify): be compatible with robots and webhooks

This commit is contained in:
rainzm
2021-03-19 11:02:32 +08:00
parent 49a798ad0e
commit 6b1f63efc9
+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