[PR #2689] [MERGED] Fix repository search function #16539

Closed
opened 2025-11-02 12:12:59 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/2689
Author: @Morlinest
Created: 10/11/2017
Status: Merged
Merged: 10/17/2017
Merged by: @lunny

Base: masterHead: fix/missing-collaborative-repositories


📝 Commits (7)

📊 Changes

10 files changed (+140 additions, -88 deletions)

View changed files

📝 integrations/api_repo_test.go (+10 -5)
📝 models/fixtures/access.yml (+25 -1)
📝 models/fixtures/org_user.yml (+8 -0)
📝 models/fixtures/team.yml (+2 -2)
📝 models/fixtures/team_user.yml (+7 -1)
📝 models/fixtures/user.yml (+17 -2)
📝 models/repo_list.go (+38 -51)
📝 models/repo_list_test.go (+19 -10)
📝 routers/api/v1/repo/repo.go (+14 -15)
📝 routers/home.go (+0 -1)

📄 Description

Rewrite of models.SearchRepositoryByName:

  1. Adds respect of organizations membership visibility
  2. Removes redudant where conditions in search (that was causing showing private repositories not available to OwnerID)
  3. Includes "collaborative" repositories only if opts.Collaborate is set (true)
  4. Removes need for Searcher as this option is confusing (you can't know, if found repository is related to OwnerID or Searcher) and not used if OwnerID is not set
  5. Fixes FIXME parts mentioned in unit and integration tests (integrations/api_repo_test.go and models/repo_list_test.go)
  6. Adds unit tests to test organizations membership visibility
  7. Adds integration tests

Important files are routers/api/v1/repo/repo.go and models/repo_list.go, other files are for tests.

Fixes #2399, #2593.

Main/final part of #2371.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/2689 **Author:** [@Morlinest](https://github.com/Morlinest) **Created:** 10/11/2017 **Status:** ✅ Merged **Merged:** 10/17/2017 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `fix/missing-collaborative-repositories` --- ### 📝 Commits (7) - [`7bc7d95`](https://github.com/go-gitea/gitea/commit/7bc7d95028860f729744427ca40c50dc6628eb85) Fix/rewrite searchRepositoryByName function - [`e8a2aed`](https://github.com/go-gitea/gitea/commit/e8a2aed1891f010d29353472d92f4ca75831716c) Fix and remove FIXME - [`50d7154`](https://github.com/go-gitea/gitea/commit/50d7154a6671d6230637ba0bd9bae080daa0dbe6) Respect membership visibility - [`b9cb558`](https://github.com/go-gitea/gitea/commit/b9cb5589dd707964432abad165214ea8e62c819a) Add unit tests - [`db87c27`](https://github.com/go-gitea/gitea/commit/db87c27f5b8f166a1a26b0c7ec8f7f4b9f1973b5) Add integration tests - [`ff3dba9`](https://github.com/go-gitea/gitea/commit/ff3dba9b0eade7e5e3118fc4217639a8391fd319) Remove Searcher completely - [`7686465`](https://github.com/go-gitea/gitea/commit/7686465c2754f0fe89368d520036f884d4b7d09f) Remove trailing space ### 📊 Changes **10 files changed** (+140 additions, -88 deletions) <details> <summary>View changed files</summary> 📝 `integrations/api_repo_test.go` (+10 -5) 📝 `models/fixtures/access.yml` (+25 -1) 📝 `models/fixtures/org_user.yml` (+8 -0) 📝 `models/fixtures/team.yml` (+2 -2) 📝 `models/fixtures/team_user.yml` (+7 -1) 📝 `models/fixtures/user.yml` (+17 -2) 📝 `models/repo_list.go` (+38 -51) 📝 `models/repo_list_test.go` (+19 -10) 📝 `routers/api/v1/repo/repo.go` (+14 -15) 📝 `routers/home.go` (+0 -1) </details> ### 📄 Description Rewrite of `models.SearchRepositoryByName`: 1. Adds respect of organizations membership visibility 2. Removes redudant `where` conditions in search (that was causing showing private repositories not available to `OwnerID`) 3. Includes "collaborative" repositories only if `opts.Collaborate` is set (`true`) 4. Removes need for `Searcher` as this option is confusing (you can't know, if found repository is related to `OwnerID` or `Searcher`) and not used if `OwnerID` is not set 5. Fixes `FIXME` parts mentioned in unit and integration tests (`integrations/api_repo_test.go` and `models/repo_list_test.go`) 6. Adds unit tests to test organizations membership visibility 7. Adds integration tests Important files are `routers/api/v1/repo/repo.go` and `models/repo_list.go`, other files are for tests. Fixes #2399, #2593. Main/final part of #2371. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:12:59 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#16539