Просмотр исходного кода

feat: fixing conversions in metrics (#31610)

GitOrigin-RevId: 76bae4b780c3b9a2c1de6c8d0bbf175634080804
Jimmy Domagala-Tang 5 месяцев назад
Родитель
Сommit
af82f25944

+ 8 - 1
services/web/app/src/Features/UserMembership/UserMembershipMiddleware.mjs

@@ -292,7 +292,14 @@ function requireGraphAccess(req, res, next) {
   // call next router with fixed params to pass it to the correct middleware chain
   const { graph } = req.params
   const entityRoute = entityName === 'splitTest' ? 'split-test' : entityName
-  req.url = `/graphs/${entityRoute}/${graph}/${req.query.resource_id}`
+
+  // all other routes go through analytics, which map undefined graph type to index (to fetch all graphs)
+  // conversion still goes directly to v1, which can not handle an undefined graph param
+  if (!graph?.length && entityRoute === 'conversion') {
+    req.url = `/graphs/conversion/index/${req.query.resource_id}`
+  } else {
+    req.url = `/graphs/${entityRoute}/${graph}/${req.query.resource_id}`
+  }
   next('route')
 }