forgejo/models/repo
Mathieu Fenniak 28e0af25b4 perf: remove redundant & incorrect filters on 'SearchRepoOptions.OwnerID' (#11729)
Improves the performance of the `/repo/search?uid=N` API call, which is used on the user's dashboard to load a repo list.  More detailed notes are in https://codeberg.org/forgejo/forgejo/issues/11702.

Removes a redundant query condition (that a user was part of a team in an organization which could see a repo), and a condition that seems incorrect (that a repo could be seen just by being public within a private org, which is incorrect because that doesn't mean the user is a collaborator on the repo).

Covered by over 30 test cases in `repo_list_test.go` which did not fail from these changes.  Mutation testing (removing the remaining "2." condition) verified that the codepath is covered as tests did fail.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests for Go changes

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11729
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2026-03-18 17:01:44 +01:00
..
fixtures/TestFindRepoAttachmentsByUUID chore: add unit test 2026-03-06 11:21:07 -07:00
TestGetUserForkLax fix: reduce deadlocks merging PRs by using caching for repo issue count stats (#9922) 2025-10-31 23:50:05 +01:00
TestGetUserForkLaxWithTwoChoices fix: reduce deadlocks merging PRs by using caching for repo issue count stats (#9922) 2025-10-31 23:50:05 +01:00
TestSearchRepositoryIDsByCondition fix: reduce deadlocks merging PRs by using caching for repo issue count stats (#9922) 2025-10-31 23:50:05 +01:00
archive_download_count.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
archive_download_count_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
archiver.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
attachment.go fix: check that attachments belong to correct resource 2026-03-06 11:21:07 -07:00
attachment_test.go chore: add unit test 2026-03-06 11:21:07 -07:00
authz.go refactor: split AuthorizationReducer into a base RepositoryAuthorizationReducer interface 2026-03-01 17:05:53 +01:00
avatar.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
collaboration.go feat: add foreign keys to table collaboration (#9724) 2025-10-18 02:50:50 +02:00
collaboration_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
following_repo.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
following_repo_test.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
fork.go feat: allow PRs between common forks of the same base repository (#9045) 2025-10-01 04:58:12 +02:00
fork_test.go feat: allow PRs between common forks of the same base repository (#9045) 2025-10-01 04:58:12 +02:00
git.go feat: introduce global merge message templates (#8347) 2025-07-12 16:00:42 +02:00
issue.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
language_stats.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
language_stats_test.go chore: remove usages of sort.Sort (#6689) 2025-01-26 13:30:00 +00:00
main_test.go chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
mirror.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
moderation.go feat: render a link to poster profile next to the ID within shadow copy details (#10194) 2025-12-09 15:19:10 +01:00
moderation_test.go feat: Admin interface for abuse reports (#7905) 2025-07-23 00:20:15 +02:00
pushmirror.go feat: cache derived keys for faster keying (#10114) 2025-11-16 14:29:14 +01:00
pushmirror_test.go feat: add configuration to only push mirror selected branches (#7823) 2025-07-12 00:39:35 +02:00
redirect.go fix: do permission check for repository redirect 2025-08-30 09:37:34 +02:00
redirect_test.go fix: do permission check for repository redirect 2025-08-30 09:37:34 +02:00
release.go fix: check that attachments belong to correct resource 2026-03-06 11:21:07 -07:00
release_list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
release_list_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
release_test.go feat: add tag label to commit list view (#8759) 2025-08-06 14:47:51 +02:00
repo.go feat(ui): display repositories accessible by repo-specific access tokens (#11604) 2026-03-12 16:06:38 +01:00
repo_flags.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_flags_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_indexer.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_list.go perf: remove redundant & incorrect filters on 'SearchRepoOptions.OwnerID' (#11729) 2026-03-18 17:01:44 +01:00
repo_list_test.go refactor: replace Value() from Option[T] with Get() & ValueOrZeroValue() (#11218) 2026-02-10 16:41:21 +01:00
repo_repository.go fix: assorted ActivityPub code only refactors (#8708) 2025-07-28 15:17:29 +02:00
repo_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo_unit.go fix: a corrupted Forgejo Actions scheduled workflow is disabled (#8942) 2025-08-18 22:45:10 +02:00
repo_unit_test.go fix: corrupted wiki unit default permission (#8234 follow-up) (#8258) 2025-07-07 18:04:00 +02:00
search.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
star.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
star_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
topic.go chore(api): update swagger method descripitons (#8728) 2025-07-30 18:08:28 +02:00
topic_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
update.go chore: remove redundant code (#9378) 2025-09-22 09:18:19 +02:00
update_test.go chore: remove redundant code (#9378) 2025-09-22 09:18:19 +02:00
upload.go feat: Drag and drop nested directories (#6687) 2025-10-03 00:16:40 +02:00
user_repo.go feat: implement fine-grained access tokens in /user/subscriptions & /users/{username}/subscriptions 2026-03-01 17:05:53 +01:00
user_repo_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
watch.go fix: decrease watch count when blocking user (#10882) 2026-01-26 22:58:22 +01:00
watch_test.go chore: remove dead code in WatchIfAuto and general model documentation (#10880) 2026-01-26 12:03:08 +01:00
wiki.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
wiki_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00