* remove FEATURE_NEW_VERSIONS from feature-flags.json * remove process.env.FEATURE_NEW_VERSIONS from include files * remove process.env.FEATURE_NEW_VERSIONS from lib files * remove process.env.FEATURE_NEW_VERSIONS from middleware files * remove process.env.FEATURE_NEW_VERSIONS from script files * remove process.env.FEATURE_NEW_VERSIONS from test files * update test fixtures to use new versions as canonical fixtures
19 lines
838 B
JavaScript
19 lines
838 B
JavaScript
const path = require('path')
|
|
const { defaults } = require('lodash')
|
|
const webhookPayloads = require(path.join(process.cwd(), 'lib/webhooks'))
|
|
const { getOldVersionFromNewVersion } = require('../../lib/old-versions-utils')
|
|
|
|
module.exports = async (req, res, next) => {
|
|
// TODO need to update this to the new versions in coordination with the updater scripts
|
|
const currentOldVersion = getOldVersionFromNewVersion(req.context.currentVersion)
|
|
|
|
const webhookPayloadsForCurrentVersion = webhookPayloads[currentOldVersion]
|
|
|
|
// if current version is GHE, include dotcom payloads in object so we can fall back to them if needed
|
|
req.context.webhookPayloadsForCurrentVersion = currentOldVersion === 'dotcom'
|
|
? webhookPayloadsForCurrentVersion
|
|
: defaults(webhookPayloadsForCurrentVersion, webhookPayloads.dotcom)
|
|
|
|
return next()
|
|
}
|