Skip to content

Commit a2bc6c7

Browse files
authored
Merge pull request github#7269 from github/repo-sync
repo sync
2 parents 4c67179 + 479e18d commit a2bc6c7

File tree

12 files changed

+27
-13
lines changed

12 files changed

+27
-13
lines changed

components/DefaultLayout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useTranslation } from './hooks/useTranslation'
1111

1212
type Props = { children?: React.ReactNode }
1313
export const DefaultLayout = (props: Props) => {
14-
const { builtAssets, expose, page, error, isHomepageVersion } = useMainContext()
14+
const { builtAssets, page, error, isHomepageVersion } = useMainContext()
1515
const { t } = useTranslation('errors')
1616
return (
1717
<div className="d-lg-flex">
@@ -22,7 +22,6 @@ export const DefaultLayout = (props: Props) => {
2222
<title>{page.fullTitle}</title>
2323
) : null}
2424

25-
<script id="expose" type="application/json" dangerouslySetInnerHTML={{ __html: expose }} />
2625
<script src={builtAssets.main.js} />
2726

2827
{/* For Google and Bots */}

components/Search.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,11 @@ export function Search({ isStandalone = false, updateSearchParams = true, childr
3030
const { currentVersion } = useVersion()
3131

3232
// Figure out language and version for index
33-
const { expose } = useMainContext()
34-
const {
35-
searchOptions: { languages, versions, nonEnterpriseDefaultVersion },
36-
} = JSON.parse(expose)
33+
const { languages, searchVersions, nonEnterpriseDefaultVersion } = useMainContext()
3734
const router = useRouter()
3835
// fall back to the non-enterprise default version (FPT currently) on the homepage, 404 page, etc.
39-
const version = versions[currentVersion] || versions[nonEnterpriseDefaultVersion]
40-
const language = (languages.includes(router.locale) && router.locale) || 'en'
36+
const version = searchVersions[currentVersion] || searchVersions[nonEnterpriseDefaultVersion]
37+
const language = (Object.keys(languages).includes(router.locale || '') && router.locale) || 'en'
4138

4239
// If the user shows up with a query in the URL, go ahead and search for it
4340
useEffect(() => {

components/context/MainContext.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export type MainContextT = {
6969
article?: BreadcrumbT
7070
}
7171
builtAssets: { main: { js: string } }
72-
expose: string
7372
activeProducts: Array<ProductT>
7473
currentProduct?: ProductT
7574
currentLayoutName: string
@@ -106,12 +105,14 @@ export type MainContextT = {
106105
}
107106

108107
enterpriseServerVersions: Array<string>
108+
109+
searchVersions: Record<string, string>
110+
nonEnterpriseDefaultVersion: string
109111
}
110112

111113
export const getMainContextFromRequest = (req: any): MainContextT => {
112114
return {
113115
builtAssets: { main: { js: req.context.builtAssets.main.js } },
114-
expose: req.context.expose,
115116
breadcrumbs: req.context.breadcrumbs || {},
116117
activeProducts: req.context.activeProducts,
117118
currentProduct: req.context.productMap[req.context.currentProduct] || null,
@@ -179,6 +180,8 @@ export const getMainContextFromRequest = (req: any): MainContextT => {
179180
? getCurrentProductTree(req.context.currentProductTree)
180181
: null,
181182
featureFlags: {},
183+
searchVersions: req.context.searchVersions,
184+
nonEnterpriseDefaultVersion: req.context.nonEnterpriseDefaultVersion,
182185
}
183186
}
184187

content/github/site-policy/github-candidate-privacy-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ We use the Candidate Personal Information for the following purposes:
4646
- To prepare and submit reports as required under local laws and regulations;
4747
- To manage and improve our application and recruitment process (such as making the application process more efficient and improving our diversity practices).
4848

49-
### How do we share your Candidate Personal Information?
49+
### How do we share your Candidate Personal Information?
5050

5151
GitHub will share your Candidate Personal Information with those who have a legitimate business need for it. Whenever we permit a third party to access your Candidate Personal Information, we will make sure the information is used in a manner consistent with this policy. Your Candidate Personal Information may be shared with our affiliates (such as Microsoft) and other third parties (such as vendors) for the following purposes:
5252
1. In order to carry out the uses of Candidate Personal Information described above;

content/github/site-policy/guidelines-for-legal-requests-of-user-data.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ c/o Corporation Service Company
226226
Sacramento, CA 95833-3505
227227
```
228228

229+
Courtesy copies may be emailed to legal@support.github.com.
230+
229231
Please make your requests as specific and narrow as possible, including the following information:
230232

231233
- Full information about authority issuing the request for information

javascripts/airgap-links.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export default function airgapLinks () {
2+
if (window.IS_NEXTJS_PAGE) return
3+
24
// When in an airgapped environment,
35
// show a tooltip on external links
46
const { airgap } = JSON.parse(document.getElementById('expose').text)

javascripts/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import releaseNotes from './release-notes'
2222
import showMore from './show-more'
2323
import airgapLinks from './airgap-links'
2424
import toggleImages from './toggle-images'
25+
import setNextEnv from './set-next-env'
2526

2627
document.addEventListener('DOMContentLoaded', async () => {
28+
setNextEnv()
2729
displayPlatformSpecificContent()
2830
displayToolSpecificContent()
2931
explorer()

javascripts/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let version
1515
let language
1616

1717
export default function search () {
18-
if (window.next) return
18+
if (window.IS_NEXTJS_PAGE) return
1919

2020
// We don't want to mess with query params intended for the GraphQL Explorer
2121
isExplorerPage = Boolean(document.getElementById('graphiql'))

javascripts/set-next-env.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function setNextEnv () {
2+
window.IS_NEXTJS_PAGE = !!document.querySelector('#__next')
3+
}

javascripts/survey.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function trackEvent ({ token, vote, email, comment }) {
4646
}
4747

4848
export default function survey () {
49-
if (window.next) return
49+
if (window.IS_NEXTJS_PAGE) return
5050

5151
const form = document.querySelector('.js-survey')
5252
const texts = Array.from(document.querySelectorAll('.js-survey input, .js-survey textarea'))

0 commit comments

Comments
 (0)