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

fix: Only show GH app config banner if admin #3691

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

calvin-codecov
Copy link
Contributor

@calvin-codecov calvin-codecov commented Jan 29, 2025

Description

Closes codecov/engineering-team#3287

Background info copied from ^ for context:
In the new non-PAT appless experience, we made a shift of rendering the GH Config Banner from <HeaderBanners> to <ListRepo> which moved it outside of scope of the SilentNetworkErrorWrapper. The account-details API (used for getting data about if org has GH app installed) call 404s inside of that ErrorBoundary wrapper so anything isGHApp related would just error and be caught by the boundary. Now that we've moved <GithubConfigBanner> out, it needs more boolean checks to make sure we only show it for admins on their org that does not have the GH app already installed. We also don't want to show this at the same time as the "Welcome" banner when someone just onboards.

Notable Changes

Check that the user viewing the org page is an admin to get the GH Config Banner. Rest of the changes are just minor refactors and TS conversion made while I was there.

Screenshots

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

{/* we only want one of these two banners to show at a time */}
{!hasGhApp && !showDemoAlert && <GithubConfigBanner />}
{/* we only want one of this or DemoAlert banners to show at a time */}
{isAdmin && !hasGhApp && !showDemoAlert ? <GithubConfigBanner /> : null}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change.

@calvin-codecov calvin-codecov changed the title fix: Only show GH config app if admin fix: Only show GH app config banner if admin Jan 29, 2025
@codecov-staging
Copy link

codecov-staging bot commented Jan 29, 2025

Bundle Report

Changes will increase total bundle size by 443 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system 6.22MB 225 bytes (0.0%) ⬆️
gazebo-staging-esm 6.27MB 218 bytes (0.0%) ⬆️

@codecov-notifications
Copy link

codecov-notifications bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/pages/OwnerPage/OwnerPage.jsx 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3691      +/-   ##
==========================================
- Coverage   98.79%   98.78%   -0.01%     
==========================================
  Files         825      825              
  Lines       14808    14806       -2     
  Branches     4203     4193      -10     
==========================================
- Hits        14629    14626       -3     
- Misses        170      171       +1     
  Partials        9        9              
Files with missing lines Coverage Δ
src/shared/ListRepo/ListRepo.tsx 100.00% <100.00%> (ø)
src/pages/OwnerPage/OwnerPage.jsx 96.87% <0.00%> (-3.13%) ⬇️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.40% <0.00%> (-0.02%) ⬇️
Services 99.27% <ø> (ø)
Shared 99.36% <100.00%> (-0.01%) ⬇️
UI 99.07% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2f8a95...a869199. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.78%. Comparing base (a2f8a95) to head (a869199).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/pages/OwnerPage/OwnerPage.jsx 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3691      +/-   ##
==========================================
- Coverage   98.79%   98.78%   -0.01%     
==========================================
  Files         825      825              
  Lines       14808    14806       -2     
  Branches     4203     4193      -10     
==========================================
- Hits        14629    14626       -3     
- Misses        170      171       +1     
  Partials        9        9              
Files with missing lines Coverage Δ
src/shared/ListRepo/ListRepo.tsx 100.00% <100.00%> (ø)
src/pages/OwnerPage/OwnerPage.jsx 96.87% <0.00%> (-3.13%) ⬇️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.40% <0.00%> (-0.02%) ⬇️
Services 99.27% <ø> (ø)
Shared 99.36% <100.00%> (-0.01%) ⬇️
UI 99.07% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2f8a95...a869199. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Jan 29, 2025

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
642d734 Wed, 29 Jan 2025 19:54:10 GMT Expired Expired
a869199 Wed, 29 Jan 2025 21:54:02 GMT Cloud Enterprise

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥔

Copy link
Contributor

@spalmurray-codecov spalmurray-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be working! v nice

@calvin-codecov calvin-codecov added this pull request to the merge queue Jan 29, 2025
Merged via the queue into main with commit b53522f Jan 29, 2025
45 of 54 checks passed
@calvin-codecov calvin-codecov deleted the cy/hide_gh_banner_not_associated branch January 29, 2025 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GH Config Banner Shows When Not a Member
3 participants