Skip to content

Commit 5b59619

Browse files
authored
Adding Product feedback redirect (#20785)
* adding product feedback redirect for community on sponsors, discussions, and actions community link * remove community redirect from actions and add to codespaces and add tests * update wording for these links * updating to add name of the button to frontmatter
1 parent 9d7c9ae commit 5b59619

7 files changed

Lines changed: 60 additions & 2 deletions

File tree

components/context/MainContext.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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',

components/page-footer/Support.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@ import { PeopleIcon, CommentDiscussionIcon } from '@primer/octicons-react'
22

33
import { useTranslation } from 'components/hooks/useTranslation'
44
import { useVersion } from 'components/hooks/useVersion'
5+
import { useMainContext } from 'components/context/MainContext'
56

67
export 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"

content/codespaces/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ featuredLinks:
2424
- /codespaces/setting-up-your-codespace/personalizing-codespaces-for-your-account
2525
popularHeading: Set up your project
2626
product_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'
2730
redirect_from:
2831
- /github/developing-online-with-github-codespaces
2932
- /github/developing-online-with-codespaces

content/discussions/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ changelog:
2727
examples_source: data/product-examples/discussions/community-examples.yml
2828
product_video: 'https://www.youtube-nocookie.com/embed/IpBw2SJkFyk'
2929
layout: product-landing
30+
community_redirect:
31+
name: 'Provide GitHub Feedback'
32+
href: 'https://github.com/github/feedback/discussions/categories/discussions-feedback'
3033
versions:
3134
fpt: '*'
3235
children:

content/sponsors/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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
<!---->

lib/frontmatter.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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',

tests/rendering/footer.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff 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
})

0 commit comments

Comments
 (0)