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

Update browser extension icon state on private repositories #14926

Merged
merged 5 commits into from Oct 21, 2020

Conversation

marekweb
Copy link
Contributor

Summary

Make browser extension show the alert icon when the user is looking at a private repository. This invites the user to open the options popup, where a message is displayed that indicates the steps to take to use the browser extension on private repositories.

Implementation

Update observeBrowserActionState to emit active-with-alert when the currently active tab is open on a private repository (when the extension is not disabled.) The emitted values of this observable are used to update the icon.

Adds two observables to the background page:

  • observeCurrentTabId() emits the current active tab id
  • observeCurrentTabPrivateRepository() emits a boolean flag indicating whether the current active tab contains a private repository.

Also adds a subject that emits the background page's cache of which tabs are open on a private repository: privateRepositoryCacheSubject

Now, instead of updating the tabPrivateRepositoryCache (a Map<number, boolean>) directly when a private repository is detected, the background page calls setTabIsPrivateRepository so that the change can be emitted through the subject.

Closes #14867

@codecov
Copy link

codecov bot commented Oct 20, 2020

Codecov Report

Merging #14926 into main will increase coverage by 3.52%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main   #14926      +/-   ##
==========================================
+ Coverage   48.65%   52.17%   +3.52%     
==========================================
  Files        1555     1555              
  Lines       79496    79511      +15     
  Branches     7107     7095      -12     
==========================================
+ Hits        38676    41487    +2811     
+ Misses      37073    34277    -2796     
  Partials     3747     3747              
Flag Coverage Δ
#go 52.35% <ø> (+<0.01%) ⬆️
#integration 30.49% <0.00%> (?)
#storybook 22.14% <0.00%> (-0.03%) ⬇️
#typescript 51.73% <0.00%> (+12.13%) ⬆️
#unit 33.68% <0.00%> (-0.03%) ⬇️
Impacted Files Coverage Δ
...c/browser-extension/scripts/backgroundPage.main.ts 0.00% <0.00%> (ø)
cmd/repo-updater/repos/types.go 74.44% <0.00%> (+0.24%) ⬆️
client/web/src/search/results/SearchResults.tsx 58.13% <0.00%> (+1.55%) ⬆️
...lient/web/src/search/results/SearchResultsList.tsx 73.75% <0.00%> (+1.87%) ⬆️
client/web/src/org/area/OrgInvitationPage.tsx 2.08% <0.00%> (+2.08%) ⬆️
client/web/src/site-admin/backend.tsx 3.66% <0.00%> (+2.75%) ⬆️
client/web/src/nav/NavLinks.tsx 87.50% <0.00%> (+3.12%) ⬆️
...se/campaigns/close/CampaignCloseChangesetsList.tsx 82.75% <0.00%> (+3.44%) ⬆️
client/web/src/global/GlobalAlert.tsx 3.57% <0.00%> (+3.57%) ⬆️
client/web/src/search/helpers.tsx 96.55% <0.00%> (+4.31%) ⬆️
... and 195 more

Copy link
Contributor

@felixfbecker felixfbecker left a comment

Choose a reason for hiding this comment

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

Nice! One suggestion, otherwise LGTM!

Marek and others added 2 commits October 21, 2020 09:20
Co-authored-by: Felix Becker <felix.b@outlook.com>
@felixfbecker
Copy link
Contributor

:shipit:

@marekweb marekweb merged commit ab9da46 into main Oct 21, 2020
@marekweb marekweb deleted the update-icon-state-on-private-repo branch October 21, 2020 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-extension RFC-221 Browser extension - improve discoverability and awerness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Being on private repo does not change browser extension icon
3 participants