Merge pull request #12430 from overleaf/jel-tests-in-locals

[web] Move middleware setting split tests in locals

GitOrigin-RevId: 07e0203ef13d8686cf8f7a2237a45bbdab2ac3ed
This commit is contained in:
Jessica Lawshe 2023-04-03 08:57:47 -05:00 committed by Copybot
parent 17525532d0
commit 5b1d95748d
2 changed files with 11 additions and 11 deletions

View file

@ -9,6 +9,7 @@ const moment = require('moment')
const request = require('request')
const Features = require('./Features')
const SessionManager = require('../Features/Authentication/SessionManager')
const SplitTestMiddleware = require('../Features/SplitTests/SplitTestMiddleware')
const PackageVersions = require('./PackageVersions')
const Modules = require('./Modules')
const {
@ -18,6 +19,7 @@ const {
const {
addOptionalCleanupHandlerAfterDrainingConnections,
} = require('./GracefulShutdown')
const { expressify } = require('../util/promises')
const IEEE_BRAND_ID = Settings.ieeeBrandId
@ -76,6 +78,15 @@ function getWebpackAssets(entrypoint, section) {
}
module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
webRouter.use(
expressify(
SplitTestMiddleware.loadAssignmentsInLocals([
'design-system-updates',
'features-page',
])
)
)
if (process.env.NODE_ENV === 'development') {
// In the dev-env, delay requests until we fetched the manifest once.
webRouter.use(function (req, res, next) {

View file

@ -56,7 +56,6 @@ const UserMembershipRouter = require('./Features/UserMembership/UserMembershipRo
const SystemMessageController = require('./Features/SystemMessages/SystemMessageController')
const AnalyticsRegistrationSourceMiddleware = require('./Features/Analytics/AnalyticsRegistrationSourceMiddleware')
const AnalyticsUTMTrackingMiddleware = require('./Features/Analytics/AnalyticsUTMTrackingMiddleware')
const SplitTestMiddleware = require('./Features/SplitTests/SplitTestMiddleware')
const CaptchaMiddleware = require('./Features/Captcha/CaptchaMiddleware')
const { Joi, validate } = require('./infrastructure/Validation')
const {
@ -66,7 +65,6 @@ const {
const logger = require('@overleaf/logger')
const _ = require('underscore')
const { expressify } = require('./util/promises')
const { plainTextResponse } = require('./infrastructure/Response')
const PublicAccessLevels = require('./Features/Authorization/PublicAccessLevels')
const UserContentDomainController = require('./Features/UserContentDomainCheck/UserContentDomainController')
@ -229,15 +227,6 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) {
webRouter.get('*', AnalyticsRegistrationSourceMiddleware.setInbound())
webRouter.get('*', AnalyticsUTMTrackingMiddleware.recordUTMTags())
webRouter.get(
'*',
expressify(
SplitTestMiddleware.loadAssignmentsInLocals([
'design-system-updates',
'features-page',
])
)
)
// Mount onto /login in order to get the deviceHistory cookie.
webRouter.post(