Skip to content

Commit

Permalink
Merge branch 'cy/non_pat_appless' into cy/how_to_onboard
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin-codecov authored Jan 22, 2025
2 parents c296f24 + 4a1350e commit e5e1888
Show file tree
Hide file tree
Showing 128 changed files with 3,006 additions and 1,127 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
25.1.10
25.1.16
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@babel/eslint-parser": "^7.25.9",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@chromatic-com/storybook": "^1",
"@codecov/vite-plugin": "^1.7.0",
"@codecov/vite-plugin": "^1.8.0",
"@sentry/vite-plugin": "^2.22.7",
"@storybook/addon-a11y": "^8.3.7",
"@storybook/addon-actions": "^8.3.7",
Expand Down
2 changes: 1 addition & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
Disallow: /
2 changes: 1 addition & 1 deletion src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('App', () => {
graphql.query('GetPlanData', () => {
return HttpResponse.json({ data: {} })
}),
graphql.query('OwnerTier', () => {
graphql.query('IsTeamPlan', () => {
return HttpResponse.json({ data: {} })
}),
graphql.query('Seats', () => {
Expand Down
10 changes: 10 additions & 0 deletions src/assets/billing/bank.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/pages/AnalyticsPage/Chart/Chart.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ describe('Analytics coverage chart', () => {

return HttpResponse.json({ data: mockDataPoints })
}),
graphql.query('OwnerTier', () =>
HttpResponse.json({ data: { owner: { plan: { tierName: 'pro' } } } })
graphql.query('IsTeamPlan', () =>
HttpResponse.json({ data: { owner: { plan: { isTeamPlan: false } } } })
)
)
}
Expand Down
14 changes: 6 additions & 8 deletions src/pages/AnalyticsPage/Chart/useCoverage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { graphql, HttpResponse } from 'msw'
import { setupServer } from 'msw/node'
import { MemoryRouter, Route } from 'react-router-dom'

import { TierNames, TTierNames } from 'services/tier'

import { useCoverage } from './useCoverage'

vi.mock('services/charts')
Expand Down Expand Up @@ -65,14 +63,14 @@ afterAll(() => {

interface SetupArgs {
nullFirstVal?: boolean
tierValue?: TTierNames
isTeamPlan?: boolean
}

describe('useCoverage', () => {
function setup(
{ nullFirstVal, tierValue }: SetupArgs = {
{ nullFirstVal, isTeamPlan }: SetupArgs = {
nullFirstVal: false,
tierValue: TierNames.PRO,
isTeamPlan: false,
}
) {
server.use(
Expand All @@ -85,9 +83,9 @@ describe('useCoverage', () => {
}
return HttpResponse.json({ data: mockRepoMeasurements })
}),
graphql.query('OwnerTier', () => {
graphql.query('IsTeamPlan', () => {
return HttpResponse.json({
data: { owner: { plan: { tierName: tierValue } } },
data: { owner: { plan: { isTeamPlan } } },
})
})
)
Expand Down Expand Up @@ -140,7 +138,7 @@ describe('useCoverage', () => {

describe('owner is on a team plan', () => {
it('gets public repos from useReposCoverageMeasurements', async () => {
setup({ tierValue: TierNames.TEAM })
setup({ isTeamPlan: true })
const { result } = renderHook(
() =>
useCoverage({
Expand Down
8 changes: 3 additions & 5 deletions src/pages/AnalyticsPage/Chart/useCoverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMemo } from 'react'
import { useParams } from 'react-router-dom'

import { useReposCoverageMeasurements } from 'services/charts/useReposCoverageMeasurements'
import { TierNames, useTier } from 'services/tier'
import { useIsTeamPlan } from 'services/useIsTeamPlan'
import { analyticsQuery } from 'shared/utils/timeseriesCharts'

interface URLParams {
Expand All @@ -28,9 +28,7 @@ export const useCoverage = ({
}: UseCoverageArgs) => {
const { provider, owner } = useParams<URLParams>()

const { data: tierName } = useTier({ provider, owner })
const shouldDisplayPublicReposOnly =
tierName === TierNames.TEAM ? true : undefined
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })

const queryVars = analyticsQuery({ startDate, endDate, repositories })

Expand All @@ -41,7 +39,7 @@ export const useCoverage = ({
repos: queryVars?.repositories,
before: queryVars?.endDate,
after: queryVars?.startDate,
isPublic: shouldDisplayPublicReposOnly,
isPublic: isTeamPlan === true ? true : undefined,
opts: {
staleTime: 30000,
keepPreviousData: false,
Expand Down
11 changes: 5 additions & 6 deletions src/pages/AnalyticsPage/ChartSelectors/ChartSelectors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useMemo, useRef, useState } from 'react'
import { useParams } from 'react-router-dom'

import { ReposQueryOpts } from 'services/repos/ReposQueryOpts'
import { TierNames, useTier } from 'services/tier'
import { useIsTeamPlan } from 'services/useIsTeamPlan'
import A from 'ui/A'
import DateRangePicker from 'ui/DateRangePicker'
import MultiSelect from 'ui/MultiSelect'
Expand Down Expand Up @@ -53,8 +53,7 @@ function RepoSelector({
updateParams({ repositories: item })
}

const { data: tierName } = useTier({ provider, owner })
const shouldDisplayPublicReposOnly = tierName === TierNames.TEAM ? true : null
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })

const {
data: reposData,
Expand All @@ -69,7 +68,7 @@ function RepoSelector({
activated: active,
term: search,
first: Infinity,
isPublic: shouldDisplayPublicReposOnly,
isPublic: isTeamPlan === true ? true : null,
})
)

Expand Down Expand Up @@ -114,7 +113,7 @@ function ChartSelectors({ params, updateParams, active, sortItem }) {
const { repositories, startDate, endDate } = params
const [selectedRepos, setSelectedRepos] = useState(repositories)

const { data: tierData } = useTier({ provider, owner })
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })

if (selectedRepos.length > 0 && repositories.length === 0) {
setSelectedRepos([])
Expand Down Expand Up @@ -151,7 +150,7 @@ function ChartSelectors({ params, updateParams, active, sortItem }) {
>
Clear filters
</button>
{tierData === TierNames.TEAM ? (
{isTeamPlan ? (
<p className="self-end">
Public repos only. <A to={{ pageName: 'upgradeOrgPlan' }}>Upgrade</A>{' '}
to Pro to include private repos.
Expand Down
10 changes: 4 additions & 6 deletions src/pages/AnalyticsPage/ChartSelectors/ChartSelectors.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { setupServer } from 'msw/node'
import { Suspense } from 'react'
import { MemoryRouter, Route } from 'react-router-dom'

import { TierNames } from 'services/tier'

import ChartSelectors from './ChartSelectors'

class ResizeObserverMock {
Expand Down Expand Up @@ -127,16 +125,16 @@ describe('ChartSelectors', () => {
vi.clearAllMocks()
})

function setup({ hasNextPage = false, tierValue = TierNames.PRO }) {
function setup({ hasNextPage = false, isTeamPlan = false }) {
// https://github.com/testing-library/user-event/issues/1034
const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime })
const fetchNextPage = vi.fn()
const searchTerm = vi.fn()

server.use(
graphql.query('OwnerTier', () => {
graphql.query('IsTeamPlan', () => {
return HttpResponse.json({
data: { owner: { plan: { tierName: tierValue } } },
data: { owner: { plan: { isTeamPlan } } },
})
}),
graphql.query('ReposForOwner', ({ variables }) => {
Expand Down Expand Up @@ -526,7 +524,7 @@ describe('ChartSelectors', () => {

describe('owner is on a team plan', () => {
it('renders upgrade cta', async () => {
setup({ hasNextPage: false, tierValue: TierNames.TEAM })
setup({ hasNextPage: false, isTeamPlan: true })
render(
<ChartSelectors
active={true}
Expand Down
10 changes: 5 additions & 5 deletions src/pages/CommitDetailPage/CommitCoverage/CommitCoverage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SentryRoute } from 'sentry'
import { useCommit } from 'services/commit'
import { useCommitErrors } from 'services/commitErrors'
import { useRepoOverview, useRepoRateLimitStatus } from 'services/repo'
import { TierNames, useTier } from 'services/tier'
import { useIsTeamPlan } from 'services/useIsTeamPlan'
import { useOwner } from 'services/user'
import ComparisonErrorBanner from 'shared/ComparisonErrorBanner'
import GitHubRateLimitExceededBanner from 'shared/GlobalBanners/GitHubRateLimitExceeded/GitHubRateLimitExceededBanner'
Expand Down Expand Up @@ -44,7 +44,7 @@ const Loader = () => (

function CommitRoutes() {
const { provider, owner, repo, commit: commitSha } = useParams()
const { data: tierName } = useTier({ owner, provider })
const { data: isTeamPlan } = useIsTeamPlan({ owner, provider })
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { data: commitPageData } = useSuspenseQueryV5(
CommitPageDataQueryOpts({
Expand Down Expand Up @@ -74,7 +74,7 @@ function CommitRoutes() {
// is still useful info to the user
const isMissingBaseCommit = compareTypeName === 'MissingBaseCommit'

const showIndirectChanges = !(overview.private && tierName === TierNames.TEAM)
const showIndirectChanges = !(overview.private && isTeamPlan)

return (
<Suspense fallback={<Loader />}>
Expand Down Expand Up @@ -174,7 +174,7 @@ function CommitCoverageRoutes() {

function CommitCoverage() {
const { provider, owner, repo, commit: commitSha } = useParams()
const { data: tierName } = useTier({ owner, provider })
const { data: isTeamPlan } = useIsTeamPlan({ owner, provider })
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { data: rateLimit } = useRepoRateLimitStatus({ provider, owner, repo })
const { data: commitPageData } = useSuspenseQueryV5(
Expand All @@ -186,7 +186,7 @@ function CommitCoverage() {
})
)

const showCommitSummary = !(overview.private && tierName === TierNames.TEAM)
const showCommitSummary = !(overview.private && isTeamPlan)
const showFirstPullBanner =
commitPageData?.commit?.compareWithParent?.__typename === 'FirstPullRequest'
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { setupServer } from 'msw/node'
import { Suspense } from 'react'
import { MemoryRouter, Route } from 'react-router-dom'

import { TierNames } from 'services/tier/useTier'
import { UploadStateEnum } from 'shared/utils/commit'

import CommitCoverage from './CommitCoverage'
Expand Down Expand Up @@ -199,10 +198,10 @@ const mockRepoSettingsTeamData = (isPrivate = false) => ({
},
})

const mockOwnerTier = (tier = TierNames.PRO) => ({
const mockIsTeamPlan = (isTeamPlan = false) => ({
owner: {
plan: {
tierName: tier,
isTeamPlan,
},
},
})
Expand Down Expand Up @@ -396,7 +395,7 @@ describe('CommitCoverage', () => {
function setup(
{
isPrivate = false,
tierName = TierNames.PRO,
isTeamPlan = false,
hasCommitErrors = false,
hasErroredUploads = false,
hasCommitPageMissingCommitDataError = false,
Expand All @@ -407,7 +406,7 @@ describe('CommitCoverage', () => {
isGithubRateLimited = false,
} = {
isPrivate: false,
tierName: TierNames.PRO,
isTeamPlan: false,
hasCommitErrors: false,
hasErroredUploads: false,
hasCommitPageMissingCommitDataError: false,
Expand Down Expand Up @@ -443,8 +442,8 @@ describe('CommitCoverage', () => {
}),
})
}),
graphql.query('OwnerTier', () => {
return HttpResponse.json({ data: mockOwnerTier(tierName) })
graphql.query('IsTeamPlan', () => {
return HttpResponse.json({ data: mockIsTeamPlan(isTeamPlan) })
}),
graphql.query('BackfillFlagMemberships', () => {
return HttpResponse.json({ data: mockRepoBackfilledData })
Expand Down Expand Up @@ -582,7 +581,7 @@ describe('CommitCoverage', () => {
describe('user is on a team plan', () => {
it('does not render commit coverage summary', async () => {
const { queryClient, queryClientV5 } = setup({
tierName: TierNames.TEAM,
isTeamPlan: true,
isPrivate: true,
})
render(<CommitCoverage />, {
Expand All @@ -598,7 +597,7 @@ describe('CommitCoverage', () => {

it('does not render indirect changes tab', async () => {
const { queryClient, queryClientV5 } = setup({
tierName: TierNames.TEAM,
isTeamPlan: true,
isPrivate: true,
})
render(<CommitCoverage />, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
commitTreeviewString,
} from 'pages/RepoPage/utils'
import { useRepoSettingsTeam } from 'services/repo'
import { TierNames, useTier } from 'services/tier'
import { useIsTeamPlan } from 'services/useIsTeamPlan'
import TabNavigation from 'ui/TabNavigation'

function CommitCoverageTabs({
Expand All @@ -18,12 +18,10 @@ function CommitCoverageTabs({
}) {
const { provider, owner, repo } = useParams()
const location = useLocation()
const { data: tierName } = useTier({ owner, provider })
const { data: isTeamPlan } = useIsTeamPlan({ owner, provider })
const { data: repoData } = useRepoSettingsTeam()

const showIndirectChanges = !(
repoData?.repository?.private && tierName === TierNames.TEAM
)
const showIndirectChanges = !(repoData?.repository?.private && isTeamPlan)

const params = qs.parse(location.search, {
ignoreQueryPrefix: true,
Expand Down
Loading

0 comments on commit e5e1888

Please sign in to comment.