Prechádzať zdrojové kódy

don't notify v2 users on agent incidents (#4268)

d-g-town 2 rokov pred
rodič
commit
214dba713b

+ 5 - 0
api/server/handlers/cluster/notify_new_incident.go

@@ -37,8 +37,13 @@ func NewNotifyNewIncidentHandler(
 }
 
 func (c *NotifyNewIncidentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+	project, _ := r.Context().Value(types.ProjectScope).(*models.Project)
 	cluster, _ := r.Context().Value(types.ClusterScope).(*models.Cluster)
 
+	if project.GetFeatureFlag(models.ValidateApplyV2, c.Config().LaunchDarklyClient) {
+		return
+	}
+
 	request := &types.Incident{}
 
 	if ok := c.DecodeAndValidate(w, r, request); !ok {