merge and fix conflicts
This commit is contained in:
@@ -23,7 +23,7 @@ module.exports = async function genericToc (req, res, next) {
|
||||
const currentTocType = tocTypes[req.context.page.documentType]
|
||||
|
||||
// Find the part of the site tree that corresponds to the current path.
|
||||
const treePage = findPageInSiteTree(req.context.currentProductTree, req.context.currentEnglishTree, req.path)
|
||||
const treePage = findPageInSiteTree(req.context.currentProductTree, req.context.currentEnglishTree, req.pagePath)
|
||||
|
||||
// Conditionally run getTocItems() recursively.
|
||||
let isRecursive
|
||||
@@ -50,7 +50,7 @@ module.exports = async function genericToc (req, res, next) {
|
||||
async function getTocItems (pagesArray, context, isRecursive, renderIntros) {
|
||||
return (await Promise.all(pagesArray.map(async (child) => {
|
||||
// Do not include hidden child items on a TOC page
|
||||
if (child.page.hidden) return
|
||||
if (child.page.hidden && !context.currentPath.includes('/early-access/')) return
|
||||
|
||||
return {
|
||||
title: child.renderedFullTitle,
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = function graphqlContext (req, res, next) {
|
||||
const currentVersionObj = allVersions[req.context.currentVersion]
|
||||
// ignore requests to non-GraphQL reference paths
|
||||
// and to versions that don't exist
|
||||
if (!req.path.includes('/graphql/') || !currentVersionObj) {
|
||||
if (!req.pagePath.includes('/graphql/') || !currentVersionObj) {
|
||||
return next()
|
||||
}
|
||||
// Get the relevant name of the GraphQL schema files for the current version
|
||||
@@ -25,7 +25,7 @@ module.exports = function graphqlContext (req, res, next) {
|
||||
const graphqlVersion = currentVersionObj.miscVersionName
|
||||
|
||||
req.context.graphql = {
|
||||
schemaForCurrentVersion: JSON.parse(fs.readFileSync(path.join(process.cwd(), '/lib/graphql/static/schema-' + graphqlVersion + '.json'))),
|
||||
schemaForCurrentVersion: JSON.parse(fs.readFileSync(path.join(process.cwd(), `lib/graphql/static/schema-${graphqlVersion}.json`))),
|
||||
previewsForCurrentVersion: previews[graphqlVersion],
|
||||
upcomingChangesForCurrentVersion: upcomingChanges[graphqlVersion],
|
||||
prerenderedObjectsForCurrentVersion: prerenderedObjects[graphqlVersion],
|
||||
|
||||
@@ -12,7 +12,7 @@ const supported = all.filter(release => {
|
||||
|
||||
module.exports = async function releaseNotesContext (req, res, next) {
|
||||
// The `/release-notes` sub-path
|
||||
if (!(req.path.endsWith('/release-notes') || req.path.endsWith('/admin'))) return next()
|
||||
if (!(req.pagePath.endsWith('/release-notes') || req.pagePath.endsWith('/admin'))) return next()
|
||||
|
||||
const [requestedPlan, requestedRelease] = req.context.currentVersion.split('@')
|
||||
const releaseNotesPerPlan = req.context.site.data['release-notes'][requestedPlan]
|
||||
@@ -28,7 +28,7 @@ module.exports = async function releaseNotesContext (req, res, next) {
|
||||
if (hasNumberedReleases) {
|
||||
const currentReleaseNotes = releaseNotesPerPlan[`${requestedRelease.replace(/\./g, '-')}`]
|
||||
|
||||
if (!currentReleaseNotes && req.path.endsWith('/release-notes')) {
|
||||
if (!currentReleaseNotes && req.pagePath.endsWith('/release-notes')) {
|
||||
// If the GHES version doesn't have any release notes, let's be helpful and redirect to `enterprise.github.com`
|
||||
return requestedPlan === 'enterprise-server'
|
||||
? res.redirect(`https://enterprise.github.com/releases/${requestedRelease}.0/notes`)
|
||||
|
||||
@@ -15,10 +15,10 @@ module.exports = function restContext (req, res, next) {
|
||||
))
|
||||
|
||||
// ignore requests to non-REST reference paths
|
||||
if (!req.path.includes('rest/reference')) return next()
|
||||
if (!req.pagePath.includes('rest/reference')) return next()
|
||||
|
||||
// e.g. the `activity` from `/en/rest/reference/activity#events`
|
||||
const category = req.path
|
||||
const category = req.pagePath
|
||||
.split('rest/reference')[1]
|
||||
.replace(/^\//, '') // remove leading slash
|
||||
.split('/')[0]
|
||||
|
||||
@@ -7,7 +7,7 @@ module.exports = function webhooksContext (req, res, next) {
|
||||
const currentVersionObj = allVersions[req.context.currentVersion]
|
||||
// ignore requests to non-webhook reference paths
|
||||
// and to versions that don't exist
|
||||
if (!req.path.includes('webhook') || !currentVersionObj) {
|
||||
if (!req.pagePath.includes('webhook') || !currentVersionObj) {
|
||||
return next()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user