File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ export type MainContextT = {
6262 article ?: BreadcrumbT
6363 }
6464 activeProducts : Array < ProductT >
65+ community_redirect : {
66+ name : string
67+ href : string
68+ }
6569 currentProduct ?: ProductT
6670 currentLayoutName : string
6771 isHomepageVersion : boolean
@@ -106,6 +110,7 @@ export const getMainContextFromRequest = (req: any): MainContextT => {
106110 return {
107111 breadcrumbs : req . context . breadcrumbs || { } ,
108112 activeProducts : req . context . activeProducts ,
113+ community_redirect : req . context . page ?. community_redirect || { } ,
109114 currentProduct : req . context . productMap [ req . context . currentProduct ] || null ,
110115 currentLayoutName : req . context . currentLayoutName ,
111116 isHomepageVersion : req . context . page ?. documentType === 'homepage' ,
Original file line number Diff line number Diff line change @@ -2,17 +2,23 @@ import { PeopleIcon, CommentDiscussionIcon } from '@primer/octicons-react'
22
33import { useTranslation } from 'components/hooks/useTranslation'
44import { useVersion } from 'components/hooks/useVersion'
5+ import { useMainContext } from 'components/context/MainContext'
56
67export const Support = ( ) => {
78 const { isEnterprise } = useVersion ( )
89 const { t } = useTranslation ( 'support' )
10+ const { community_redirect } = useMainContext ( )
911
1012 return (
1113 < div >
1214 < h3 className = "mb-2 f4" > { t `still_need_help` } </ h3 >
13- < a id = "ask-community" href = "https://github.community" className = "btn btn-outline mr-4 mt-2" >
15+ < a
16+ id = "ask-community"
17+ href = { community_redirect . href || 'https://github.community/' }
18+ className = "btn btn-outline mr-4 mt-2"
19+ >
1420 < PeopleIcon size = "small" className = "octicon mr-1" />
15- { t `ask_community` }
21+ { Object . keys ( community_redirect ) . length === 0 ? t `ask_community` : community_redirect . name }
1622 </ a >
1723 < a
1824 id = "contact-us"
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ featuredLinks:
2424 - /codespaces/setting-up-your-codespace/personalizing-codespaces-for-your-account
2525 popularHeading : Set up your project
2626product_video : ' https://www.youtube-nocookie.com/embed/_W9B7qc9lVc'
27+ community_redirect :
28+ name : ' Provide GitHub Feedback'
29+ href : ' https://github.com/github/feedback/discussions/categories/codespaces-feedback'
2730redirect_from :
2831 - /github/developing-online-with-github-codespaces
2932 - /github/developing-online-with-codespaces
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ changelog:
2727examples_source : data/product-examples/discussions/community-examples.yml
2828product_video : ' https://www.youtube-nocookie.com/embed/IpBw2SJkFyk'
2929layout : product-landing
30+ community_redirect :
31+ name : ' Provide GitHub Feedback'
32+ href : ' https://github.com/github/feedback/discussions/categories/discussions-feedback'
3033versions :
3134 fpt : ' *'
3235children :
Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ children:
3434 - /receiving-sponsorships-through-github-sponsors
3535 - /integrating-with-github-sponsors
3636 - /guides
37+ community_redirect :
38+ name : ' Provide GitHub Feedback'
39+ href : ' https://github.com/github/feedback/discussions/categories/sponsors-feedback'
3740---
3841<!-- -->
3942<!-- -->
Original file line number Diff line number Diff line change @@ -149,6 +149,14 @@ export const schema = {
149149 interactive : {
150150 type : 'boolean' ,
151151 } ,
152+ // Redirect Community Support link to Public Discussions
153+ community_redirect : {
154+ type : 'object' ,
155+ properties : {
156+ name : 'string' ,
157+ href : 'string' ,
158+ } ,
159+ } ,
152160 // Platform-specific content preference
153161 defaultPlatform : {
154162 type : 'string' ,
Original file line number Diff line number Diff line change @@ -29,4 +29,34 @@ describe('footer', () => {
2929 expect ( $ ( 'a#contact-us' ) . attr ( 'href' ) ) . toBe ( 'https://support.github.com/contact' )
3030 } )
3131 } )
32+
33+ describe ( 'test redirects for product landing community links pages' , ( ) => {
34+ test ( 'codespaces product landing page leads to codespaces discussions page' , async ( ) => {
35+ const $ = await getDOM ( `/en/codespaces` )
36+ expect ( $ ( 'a#ask-community' ) . attr ( 'href' ) ) . toBe (
37+ 'https://github.com/github/feedback/discussions/categories/codespaces-feedback'
38+ )
39+ } )
40+
41+ test ( 'sponsors product landing page leads to sponsors discussions page' , async ( ) => {
42+ const $ = await getDOM ( `/en/sponsors` )
43+ expect ( $ ( 'a#ask-community' ) . attr ( 'href' ) ) . toBe (
44+ 'https://github.com/github/feedback/discussions/categories/sponsors-feedback'
45+ )
46+ } )
47+
48+ test ( 'codespaces product landing page leads to discussions discussions page' , async ( ) => {
49+ const $ = await getDOM ( `/en/discussions` )
50+ expect ( $ ( 'a#ask-community' ) . attr ( 'href' ) ) . toBe (
51+ 'https://github.com/github/feedback/discussions/categories/discussions-feedback'
52+ )
53+ } )
54+ } )
55+
56+ describe ( 'test redirects for non-product landing community links pages' , ( ) => {
57+ test ( 'leads to https://github.community/ when clicking on the community link' , async ( ) => {
58+ const $ = await getDOM ( `/en/github/authenticating-to-github` )
59+ expect ( $ ( 'a#ask-community' ) . attr ( 'href' ) ) . toBe ( 'https://github.community/' )
60+ } )
61+ } )
3262} )
You can’t perform that action at this time.
0 commit comments