[PR #2756] [MERGED] Add search mode option to /api/repo/search #16572

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

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/2756
Author: @Morlinest
Created: 10/21/2017
Status: Merged
Merged: 10/26/2017
Merged by: @lafriks

Base: masterHead: feature-api-repo-search-options


📝 Commits (10+)

  • 00b167c Add repo type option to /api/repo/search
  • 67b4c4a Add tests and fix result of collaborative filter in specific condition
  • ebc86a2 Fix/optimize search & tests
  • 5dbdc93 Improve integration tests
  • ebff7e0 Fix lint errors
  • d750b30 Change and improve internal implementation of repo search
  • 949cbdb Fix unit tests
  • e2c10a0 Use NonexistentID
  • 96eaf52 Make search api more general
  • 4329334 Change mirror and fork search behaviour

📊 Changes

16 files changed (+505 additions, -142 deletions)

View changed files

📝 integrations/api_repo_test.go (+51 -6)
📝 models/fixtures/access.yml (+13 -1)
📝 models/fixtures/org_user.yml (+8 -0)
📝 models/fixtures/repository.yml (+94 -0)
📝 models/fixtures/team.yml (+11 -0)
📝 models/fixtures/team_repo.yml (+13 -1)
📝 models/fixtures/team_user.yml (+7 -1)
📝 models/fixtures/user.yml (+32 -0)
📝 models/issue_indexer.go (+5 -4)
📝 models/repo_list.go (+42 -31)
📝 models/repo_list_test.go (+123 -65)
📝 models/user_test.go (+6 -3)
📝 public/swagger.v1.json (+18 -1)
📝 routers/api/v1/repo/repo.go (+59 -6)
📝 routers/home.go (+7 -8)
📝 routers/user/profile.go (+16 -15)

📄 Description

Replacement of #2326 (can't be reopen). Implements #2321.

  • Adds option to search repositories through api in particular mode (all = default, source, fork, mirror and collaborative) with same rules as in dashboard. Every repository type / search mode is related to provided owner ID.
  • Adds new validation error to search repositories api
  • Adds/improve unit and integration tests
    • New organization user (2 repositories: 1 private mirror and 1 public mirror)
    • New user (4 repositories: 1 private mirror, 1 private fork, 1 public mirror and 1 public fork), used as owner of new organization
    • new accessibility checks in integration test to improve security
  • Adds new options to SearchRepositoryByName
    • Search olny/except fork/mirror repositories or both
    • Search only collaborative repositories
    • Change behaviour to include collaborative repositories by default (every call to function was fixed to behave same as before change)

Files related to changed behaviour (3 files changed, 71 insertions(+), 8 deletions(-)):

  • models/repo_list.go
  • routers/api/v1/repo/repo.go
  • public/swagger.v1.json
  • some one line changed files due to collaborative option change

Other changed files (+353, -55 lines) are only for tests.

This change is esential for implementing #2312 (this PR will reopen #2343)


🔄 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/2756 **Author:** [@Morlinest](https://github.com/Morlinest) **Created:** 10/21/2017 **Status:** ✅ Merged **Merged:** 10/26/2017 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `feature-api-repo-search-options` --- ### 📝 Commits (10+) - [`00b167c`](https://github.com/go-gitea/gitea/commit/00b167cb848fa50b6712f2144f41e6c0edc4c48a) Add repo type option to /api/repo/search - [`67b4c4a`](https://github.com/go-gitea/gitea/commit/67b4c4a27c3ceb5ce4379f32d2046cfd68d6f13f) Add tests and fix result of collaborative filter in specific condition - [`ebc86a2`](https://github.com/go-gitea/gitea/commit/ebc86a2d8b8cb677c561bd9d8884fa7603ef72d2) Fix/optimize search & tests - [`5dbdc93`](https://github.com/go-gitea/gitea/commit/5dbdc933baaa598ae9d8e347eac8e3e5d76e914b) Improve integration tests - [`ebff7e0`](https://github.com/go-gitea/gitea/commit/ebff7e0fe74386569bcd4292d8a8c8be4b520595) Fix lint errors - [`d750b30`](https://github.com/go-gitea/gitea/commit/d750b308045976f545ea86d0ef973ac3d7a76677) Change and improve internal implementation of repo search - [`949cbdb`](https://github.com/go-gitea/gitea/commit/949cbdb1782c876a0b29097ad4a8421d88b027bb) Fix unit tests - [`e2c10a0`](https://github.com/go-gitea/gitea/commit/e2c10a099cb36da2755ab6e7b8174f246f023207) Use NonexistentID - [`96eaf52`](https://github.com/go-gitea/gitea/commit/96eaf523585e3f0708fbc392f38d58186db8edd8) Make search api more general - [`4329334`](https://github.com/go-gitea/gitea/commit/432933424b86005382d527847bdb1d9c1cf3ad1d) Change mirror and fork search behaviour ### 📊 Changes **16 files changed** (+505 additions, -142 deletions) <details> <summary>View changed files</summary> 📝 `integrations/api_repo_test.go` (+51 -6) 📝 `models/fixtures/access.yml` (+13 -1) 📝 `models/fixtures/org_user.yml` (+8 -0) 📝 `models/fixtures/repository.yml` (+94 -0) 📝 `models/fixtures/team.yml` (+11 -0) 📝 `models/fixtures/team_repo.yml` (+13 -1) 📝 `models/fixtures/team_user.yml` (+7 -1) 📝 `models/fixtures/user.yml` (+32 -0) 📝 `models/issue_indexer.go` (+5 -4) 📝 `models/repo_list.go` (+42 -31) 📝 `models/repo_list_test.go` (+123 -65) 📝 `models/user_test.go` (+6 -3) 📝 `public/swagger.v1.json` (+18 -1) 📝 `routers/api/v1/repo/repo.go` (+59 -6) 📝 `routers/home.go` (+7 -8) 📝 `routers/user/profile.go` (+16 -15) </details> ### 📄 Description Replacement of #2326 (can't be reopen). Implements #2321. - Adds option to search repositories through api in particular mode (`all` = default, `source`, `fork`, `mirror` and `collaborative`) with same rules as in dashboard. Every repository type / search mode is related to provided owner ID. - Adds new validation error to search repositories api - Adds/improve unit and integration tests - New organization user (2 repositories: 1 private mirror and 1 public mirror) - New user (4 repositories: 1 private mirror, 1 private fork, 1 public mirror and 1 public fork), used as owner of new organization - new accessibility checks in integration test to improve security - Adds new options to `SearchRepositoryByName` - Search olny/except `fork`/`mirror` repositories or both - Search only `collaborative` repositories - Change behaviour to include `collaborative` repositories by default (every call to function was fixed to behave same as before change) Files related to changed behaviour ~(`3 files changed, 71 insertions(+), 8 deletions(-)`)~: - `models/repo_list.go` - `routers/api/v1/repo/repo.go` - `public/swagger.v1.json` - some one line changed files due to `collaborative` option change Other changed files ~(+353, -55 lines)~ are only for tests. This change is esential for implementing #2312 (this PR will reopen #2343) --- <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:13:43 -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#16572