Skip to content

Commit

Permalink
Adding Product feedback redirect (github#20785)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gracepark authored Aug 11, 2021
1 parent 9d7c9ae commit 5b59619
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
5 changes: 5 additions & 0 deletions components/context/MainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export type MainContextT = {
article?: BreadcrumbT
}
activeProducts: Array<ProductT>
community_redirect: {
name: string
href: string
}
currentProduct?: ProductT
currentLayoutName: string
isHomepageVersion: boolean
Expand Down Expand Up @@ -106,6 +110,7 @@ export const getMainContextFromRequest = (req: any): MainContextT => {
return {
breadcrumbs: req.context.breadcrumbs || {},
activeProducts: req.context.activeProducts,
community_redirect: req.context.page?.community_redirect || {},
currentProduct: req.context.productMap[req.context.currentProduct] || null,
currentLayoutName: req.context.currentLayoutName,
isHomepageVersion: req.context.page?.documentType === 'homepage',
Expand Down
10 changes: 8 additions & 2 deletions components/page-footer/Support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ import { PeopleIcon, CommentDiscussionIcon } from '@primer/octicons-react'

import { useTranslation } from 'components/hooks/useTranslation'
import { useVersion } from 'components/hooks/useVersion'
import { useMainContext } from 'components/context/MainContext'

export const Support = () => {
const { isEnterprise } = useVersion()
const { t } = useTranslation('support')
const { community_redirect } = useMainContext()

return (
<div>
<h3 className="mb-2 f4">{t`still_need_help`}</h3>
<a id="ask-community" href="https://github.community" className="btn btn-outline mr-4 mt-2">
<a
id="ask-community"
href={community_redirect.href || 'https://github.community/'}
className="btn btn-outline mr-4 mt-2"
>
<PeopleIcon size="small" className="octicon mr-1" />
{t`ask_community`}
{Object.keys(community_redirect).length === 0 ? t`ask_community` : community_redirect.name}
</a>
<a
id="contact-us"
Expand Down
3 changes: 3 additions & 0 deletions content/codespaces/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ featuredLinks:
- /codespaces/setting-up-your-codespace/personalizing-codespaces-for-your-account
popularHeading: Set up your project
product_video: 'https://www.youtube-nocookie.com/embed/_W9B7qc9lVc'
community_redirect:
name: 'Provide GitHub Feedback'
href: 'https://github.com/github/feedback/discussions/categories/codespaces-feedback'
redirect_from:
- /github/developing-online-with-github-codespaces
- /github/developing-online-with-codespaces
Expand Down
3 changes: 3 additions & 0 deletions content/discussions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ changelog:
examples_source: data/product-examples/discussions/community-examples.yml
product_video: 'https://www.youtube-nocookie.com/embed/IpBw2SJkFyk'
layout: product-landing
community_redirect:
name: 'Provide GitHub Feedback'
href: 'https://github.com/github/feedback/discussions/categories/discussions-feedback'
versions:
fpt: '*'
children:
Expand Down
3 changes: 3 additions & 0 deletions content/sponsors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ children:
- /receiving-sponsorships-through-github-sponsors
- /integrating-with-github-sponsors
- /guides
community_redirect:
name: 'Provide GitHub Feedback'
href: 'https://github.com/github/feedback/discussions/categories/sponsors-feedback'
---
<!---->
<!---->
Expand Down
8 changes: 8 additions & 0 deletions lib/frontmatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ export const schema = {
interactive: {
type: 'boolean',
},
// Redirect Community Support link to Public Discussions
community_redirect: {
type: 'object',
properties: {
name: 'string',
href: 'string',
},
},
// Platform-specific content preference
defaultPlatform: {
type: 'string',
Expand Down
30 changes: 30 additions & 0 deletions tests/rendering/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,34 @@ describe('footer', () => {
expect($('a#contact-us').attr('href')).toBe('https://support.github.com/contact')
})
})

describe('test redirects for product landing community links pages', () => {
test('codespaces product landing page leads to codespaces discussions page', async () => {
const $ = await getDOM(`/en/codespaces`)
expect($('a#ask-community').attr('href')).toBe(
'https://github.com/github/feedback/discussions/categories/codespaces-feedback'
)
})

test('sponsors product landing page leads to sponsors discussions page', async () => {
const $ = await getDOM(`/en/sponsors`)
expect($('a#ask-community').attr('href')).toBe(
'https://github.com/github/feedback/discussions/categories/sponsors-feedback'
)
})

test('codespaces product landing page leads to discussions discussions page', async () => {
const $ = await getDOM(`/en/discussions`)
expect($('a#ask-community').attr('href')).toBe(
'https://github.com/github/feedback/discussions/categories/discussions-feedback'
)
})
})

describe('test redirects for non-product landing community links pages', () => {
test('leads to https://github.community/ when clicking on the community link', async () => {
const $ = await getDOM(`/en/github/authenticating-to-github`)
expect($('a#ask-community').attr('href')).toBe('https://github.community/')
})
})
})

0 comments on commit 5b59619

Please sign in to comment.