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

search: Create the "my" repo group #15093

Merged
merged 6 commits into from Oct 29, 2020
Merged

search: Create the "my" repo group #15093

merged 6 commits into from Oct 29, 2020

Conversation

ryanslade
Copy link
Contributor

@ryanslade ryanslade commented Oct 28, 2020

This change adds the "my" repo group which is available for users that
are allowed to create their own external services. It will contain all
repos that they have added.

Closes: #14919

@ryanslade ryanslade added this to the Cloud 2020-10-21 milestone Oct 28, 2020
@codecov
Copy link

codecov bot commented Oct 28, 2020

Codecov Report

Merging #15093 into main will increase coverage by 1.41%.
The diff coverage is 61.81%.

@@            Coverage Diff             @@
##             main   #15093      +/-   ##
==========================================
+ Coverage   52.60%   54.02%   +1.41%     
==========================================
  Files        1610     1472     -138     
  Lines       80573    76765    -3808     
  Branches     6958     5513    -1445     
==========================================
- Hits        42389    41472     -917     
+ Misses      34357    31509    -2848     
+ Partials     3827     3784      -43     
Flag Coverage Δ *Carryforward flag
#go 52.61% <61.81%> (+0.02%) ⬆️
#integration 30.42% <ø> (+0.01%) ⬆️ Carriedforward from 13593ef
#storybook 26.07% <ø> (-0.05%) ⬇️ Carriedforward from 13593ef
#typescript 58.27% <ø> (+5.61%) ⬆️ Carriedforward from 13593ef
#unit 53.09% <ø> (+18.80%) ⬆️ Carriedforward from 13593ef

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
cmd/frontend/graphqlbackend/repo_groups.go 0.00% <0.00%> (ø)
cmd/frontend/graphqlbackend/search.go 66.25% <0.00%> (-1.03%) ⬇️
internal/db/repos.go 63.84% <77.14%> (+2.28%) ⬆️
cmd/frontend/graphqlbackend/external_services.go 68.32% <100.00%> (+0.39%) ⬆️
...ontend/graphqlbackend/search_filter_suggestions.go 69.23% <100.00%> (ø)
.../web/src/enterprise/productSubscription/helpers.ts 0.00% <0.00%> (-100.00%) ⬇️
client/web/src/components/HeroPage.tsx 9.09% <0.00%> (-90.91%) ⬇️
...nt/web/src/extensions/ExtensionPermissionModal.tsx 16.66% <0.00%> (-83.34%) ⬇️
client/web/src/search/FilterChip.tsx 0.00% <0.00%> (-76.00%) ⬇️
client/web/src/site/LicenseExpirationAlert.tsx 25.00% <0.00%> (-75.00%) ⬇️
... and 1032 more

This change adds the "my" repo group which is available for users that
are allowed to create their own external services. It will contain all
repos that they have added.
@ryanslade ryanslade changed the title my repo group search: Create the "my" repo group Oct 28, 2020
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Oct 28, 2020

Notifying subscribers in CODENOTIFY files for diff 259b02e...8525a2c.

Notify File(s)
@LawnGnome internal/db/repos.go
internal/db/repos_db_test.go
@keegancsmith cmd/frontend/graphqlbackend/search.go
cmd/frontend/graphqlbackend/search_filter_suggestions.go

@ryanslade ryanslade requested review from a team, asdine and tsenart October 28, 2020 10:25
func (s *RepoStore) GetRepoNamesByUser(ctx context.Context, userID int32) ([]string, error) {
s.ensureStore()
return basestore.ScanStrings(s.Query(ctx, sqlf.Sprintf(`
SELECT DISTINCT (repo.name) from repo
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the DISTINCT here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they may have added the same repo from more than one external service

internal/db/repos_db_test.go Outdated Show resolved Hide resolved
cmd/frontend/graphqlbackend/search.go Outdated Show resolved Hide resolved
internal/db/repos_db_test.go Outdated Show resolved Hide resolved
}

// 🚨 SECURITY: This enforces repository permissions
repos, err = authzFilter(ctx, repos, authz.Read)
Copy link
Member

Choose a reason for hiding this comment

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

qq: Is it possible to utilize/modify s.getReposBySQL so we only have one place to call authzFilter which soon will be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered it but the new query need to join over another table and I think it would make s.getReposBySQL

When is authzFilter being removed? What is the new plan?

Copy link
Member

Choose a reason for hiding this comment

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

When is authzFilter being removed? What is the new plan?

@ryanslade authzFilter will be removed after #13708 is merged.

I considered it but the new query need to join over another table and I think it would make s.getReposBySQL

I'll see what I can do by the time.

@ryanslade ryanslade mentioned this pull request Oct 30, 2020
45 tasks
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.

Implement repogroup:"my" workaround to allow us to better dogfood user added repos
5 participants