Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[draft] Update GitHub and GitLab copy #3603

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function InstallationHelpBanner() {
const { provider } = useParams()
const { params } = useLocationParams()

if (providerToName(provider) !== 'Github') return null
if (providerToName(provider) !== 'GitHub') return null

const { setup_action: setupAction } = params
if (setupAction !== 'install') return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function UserDropdown() {
})

const { provider } = useParams<URLParams>()
const isGh = providerToName(provider) === 'Github'
const isGh = providerToName(provider) === 'GitHub'
const history = useHistory()

const items =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function GithubIntegrationCopy({ integrationId }) {
return (
<p>
This account is configured via the GitHub App. You can manage the apps
repository integration on <A to={{ pageName: 'github' }}>Github.</A>
repository integration on <A to={{ pageName: 'github' }}>GitHub.</A>
</p>
)
return (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/CodecovAIPage/InstallCodecovAI/InstallCodecovAI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const COPY_APP_INSTALL_STRING =
const InstallCodecovAI: React.FC = () => {
const { theme } = useThemeContext()
const isDarkMode = theme === Theme.DARK
const githubImage = loginProviderImage('Github', !isDarkMode)
const githubImage = loginProviderImage('GitHub', !isDarkMode)

return (
<div>
<Card>
<Card.Header>
<Card.Title size="base">
Install the Codecov AI app on Github
Install the Codecov AI app on GitHub
</Card.Title>
</Card.Header>
<Card.Content>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/DefaultOrgSelector/DefaultOrgSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function DefaultOrgSelector() {
})

const { provider } = useParams()
const isGh = providerToName(provider) === 'Github'
const isGh = providerToName(provider) === 'GitHub'

const history = useHistory()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function ResyncButton() {
function GitHubHelpBanner() {
const [showModal, setShowModal] = useState(false)
const { provider } = useParams<{ provider: Provider }>()
if (providerToName(provider) !== 'Github') return null
if (providerToName(provider) !== 'GitHub') return null

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import BannerHeading from 'ui/Banner/BannerHeading'

const GithubConfigBanner = () => {
const { provider } = useParams()
const isGh = providerToName(provider) === 'Github'
const isGh = providerToName(provider) === 'GitHub'

if (!isGh) return null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface URLParams {

const GitHubRateLimitExceededBanner = () => {
const { provider } = useParams<URLParams>()
const isGh = providerToName(provider) === 'Github'
const isGh = providerToName(provider) === 'GitHub'

if (!isGh) return null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const RequestInstallBanner = () => {
// @ts-expect-errors useLocationParams needs to be updated to support generic types
const setupAction = params?.setup_action

const isGitHubProvider = provider && providerToName(provider) === 'Github'
const isGitHubProvider = provider && providerToName(provider) === 'GitHub'

const closeModalAndSaveToLocalStorage = () => {
saveToLocalStorage(APP_INSTALL_BANNER_KEY)
Expand Down
16 changes: 8 additions & 8 deletions src/shared/utils/loginProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ export function loginProviderToShortName(loginProvider?: string) {
}

export const LOGIN_PROVIDER_NAMES = {
gh: 'Github',
gh: 'GitHub',
bb: 'BitBucket',
gl: 'Gitlab',
ghe: 'Github Enterprise',
gle: 'Gitlab Enterprise',
gl: 'GitLab',
ghe: 'GitHub Enterprise',
gle: 'GitLab Enterprise',
bbs: 'BitBucket Server',
github: 'Github',
github: 'GitHub',
bitbucket: 'BitBucket',
gitlab: 'Gitlab',
github_enterprise: 'Github Enterprise',
gitlab_enterprise: 'Gitlab Enterprise',
gitlab: 'GitLab',
github_enterprise: 'GitHub Enterprise',
gitlab_enterprise: 'GitLab Enterprise',
bitbucket_server: 'BitBucket Server',
sentry: 'Sentry',
okta: 'Okta',
Expand Down
16 changes: 8 additions & 8 deletions src/shared/utils/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
describe('providerToName', () => {
describe('when called with gh', () => {
it('returns Github', () => {
expect(providerToName('gh')).toBe('Github')
expect(providerToName('gh')).toBe('GitHub')
})
})

describe('when called with gl', () => {
it('returns Gitlab', () => {
expect(providerToName('gl')).toBe('Gitlab')
expect(providerToName('gl')).toBe('GitLab')
})
})

Expand All @@ -30,13 +30,13 @@

describe('when called with ghe', () => {
it('returns Github Enterprise', () => {
expect(providerToName('ghe')).toBe('Github Enterprise')
expect(providerToName('ghe')).toBe('GitHub Enterprise')
})
})

describe('when called with gle', () => {
it('returns Gitlab Enterprise', () => {
expect(providerToName('gle')).toBe('Gitlab Enterprise')
expect(providerToName('gle')).toBe('GitLab Enterprise')
})
})

Expand All @@ -48,13 +48,13 @@

describe('when called with Github', () => {
it('returns Github', () => {
expect(providerToName('github')).toBe('Github')
expect(providerToName('github')).toBe('GitHub')
})
})

describe('when called with Gitlab', () => {
it('returns Gitlab', () => {
expect(providerToName('gitlab')).toBe('Gitlab')
expect(providerToName('gitlab')).toBe('GitLab')
})
})

Expand All @@ -66,13 +66,13 @@

describe('when called with github_enterprise', () => {
it('returns Github Enterprise', () => {
expect(providerToName('github_enterprise')).toBe('Github Enterprise')
expect(providerToName('github_enterprise')).toBe('GitHub Enterprise')
})
})

describe('when called with gitlab-enterprise', () => {
it('returns Gitlab Enterprise', () => {
expect(providerToName('gitlab_enterprise')).toBe('Gitlab Enterprise')
expect(providerToName('gitlab_enterprise')).toBe('GitLab Enterprise')
})
})

Expand All @@ -90,12 +90,12 @@

describe('getProviderCommitURL', () => {
it('return gitlab commit URL', () => {
expect(getProviderCommitURL({ provider: 'gl', owner, repo, commit })).toBe(

Check failure on line 93 in src/shared/utils/provider.test.ts

View workflow job for this annotation

GitHub Actions / Test Runner #7 - Vitest

src/shared/utils/provider.test.ts > getProviderCommitURL > return gitlab commit URL

AssertionError: expected undefined to be 'https://gitlab.com/codecov/python/-/c…' // Object.is equality - Expected: "https://gitlab.com/codecov/python/-/commit/12de" + Received: undefined ❯ src/shared/utils/provider.test.ts:93:75
'https://gitlab.com/codecov/python/-/commit/12de'
)
})
it('return github commit URL', () => {
expect(getProviderCommitURL({ provider: 'gh', owner, repo, commit })).toBe(

Check failure on line 98 in src/shared/utils/provider.test.ts

View workflow job for this annotation

GitHub Actions / Test Runner #7 - Vitest

src/shared/utils/provider.test.ts > getProviderCommitURL > return github commit URL

AssertionError: expected undefined to be 'https://github.com/codecov/python/com…' // Object.is equality - Expected: "https://github.com/codecov/python/commit/12de" + Received: undefined ❯ src/shared/utils/provider.test.ts:98:75
'https://github.com/codecov/python/commit/12de'
)
})
Expand All @@ -107,14 +107,14 @@
it('return ghe commit URL', () => {
config.GHE_URL = 'https://github.mycompany.org'

expect(getProviderCommitURL({ provider: 'ghe', owner, repo, commit })).toBe(

Check failure on line 110 in src/shared/utils/provider.test.ts

View workflow job for this annotation

GitHub Actions / Test Runner #7 - Vitest

src/shared/utils/provider.test.ts > getProviderCommitURL > return ghe commit URL

AssertionError: expected undefined to be 'https://github.mycompany.org/codecov/…' // Object.is equality - Expected: "https://github.mycompany.org/codecov/python/commit/12de" + Received: undefined ❯ src/shared/utils/provider.test.ts:110:76
'https://github.mycompany.org/codecov/python/commit/12de'
)
})
it('return gitlab enterprise commit URL', () => {
config.GLE_URL = 'https://gitlab.mycompany.org'

expect(getProviderCommitURL({ provider: 'gle', owner, repo, commit })).toBe(

Check failure on line 117 in src/shared/utils/provider.test.ts

View workflow job for this annotation

GitHub Actions / Test Runner #7 - Vitest

src/shared/utils/provider.test.ts > getProviderCommitURL > return gitlab enterprise commit URL

AssertionError: expected undefined to be 'https://gitlab.mycompany.org/codecov/…' // Object.is equality - Expected: "https://gitlab.mycompany.org/codecov/python/-/commit/12de" + Received: undefined ❯ src/shared/utils/provider.test.ts:117:76
'https://gitlab.mycompany.org/codecov/python/-/commit/12de'
)
})
Expand Down
24 changes: 12 additions & 12 deletions src/shared/utils/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { Provider } from 'shared/api/helpers'

export function providerToName(provider: Provider) {
return {
gh: 'Github',
gh: 'GitHub',
bb: 'BitBucket',
gl: 'Gitlab',
ghe: 'Github Enterprise',
gle: 'Gitlab Enterprise',
gl: 'GitLab',
ghe: 'GitHub Enterprise',
gle: 'GitLab Enterprise',
bbs: 'BitBucket Server',
github: 'Github',
github: 'GitHub',
bitbucket: 'BitBucket',
gitlab: 'Gitlab',
github_enterprise: 'Github Enterprise',
gitlab_enterprise: 'Gitlab Enterprise',
gitlab: 'GitLab',
github_enterprise: 'GitHub Enterprise',
gitlab_enterprise: 'GitLab Enterprise',
bitbucket_server: 'BitBucket Server',
}[provider.toLowerCase()]
}
Expand Down Expand Up @@ -71,11 +71,11 @@ export function getProviderPullURL({
pullId: number
}) {
return {
Github: `https://github.com/${owner}/${repo}/pull/${pullId}`,
GitHub: `https://github.com/${owner}/${repo}/pull/${pullId}`,
BitBucket: `https://bitbucket.org/${owner}/${repo}/pull-requests/${pullId}`,
Gitlab: `https://gitlab.com/${owner}/${repo}/-/merge_requests/${pullId}`,
'Github Enterprise': `${config.GHE_URL}/${owner}/${repo}/pull/${pullId}`,
'Gitlab Enterprise': `${config.GLE_URL}/${owner}/${repo}/-/merge_requests/${pullId}`,
GitLab: `https://gitlab.com/${owner}/${repo}/-/merge_requests/${pullId}`,
'GitHub Enterprise': `${config.GHE_URL}/${owner}/${repo}/pull/${pullId}`,
'GitLab Enterprise': `${config.GLE_URL}/${owner}/${repo}/-/merge_requests/${pullId}`,
'BitBucket Server': `${config.BBS_URL}/${owner}/${repo}/pull-requests/${pullId}`,
// @ts-expect-error - provider could be undefined but it should be fine
}[providerToName(provider)]
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ContextSwitcher/ContextSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function ContextSwitcher({
const intersectionRef = useLoadMore({ onLoadMore })
const defaultOrgUsername = currentUser?.defaultOrgUsername

const isGh = providerToName(provider) === 'Github'
const isGh = providerToName(provider) === 'GitHub'
const isSelfHosted = config.IS_SELF_HOSTED
const isCustomGitHubApp = config.GH_APP !== DEFAULT_GH_APP

Expand Down
Loading