[PR #2652] [MERGED] Remove redudant functions and code #16525

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

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/2652
Author: @Morlinest
Created: 10/4/2017
Status: Merged
Merged: 10/10/2017
Merged by: @bkcsoft

Base: masterHead: fix/use-same-function-for-repo-search


📝 Commits (5)

  • 7570ff4 Remove redudant functions and code
  • 69c23f2 Lowercase column names
  • 82b6465 Remove Searcher field
  • ceb8174 Include all public repositories in search result
  • d3e349b Add unit tests

📊 Changes

5 files changed (+57 additions, -117 deletions)

View changed files

📝 models/issue_indexer.go (+3 -1)
📝 models/repo_list.go (+12 -80)
📝 models/repo_list_test.go (+19 -1)
📝 routers/admin/repos.go (+0 -1)
📝 routers/home.go (+23 -34)

📄 Description

Remove useless functions/code. Fixes multiple bugs and remove duplicated code, like:

  • Corrects ordering of repositories on admin page
  • Corrects results when searching (explore page) - now you can get 2 different results when searching with/without keyword because two different functions are used and implementation is not same for both. But results with non empty keyword should always contains subset of full search (empty keyword) results.
  • models.Repositories() ignores privacy settings in search but uses it for count (even it's always true as it is used only in 1 place with fixed privacy settings). This function can be replaced by models.SearchRepositoryByName() as it does exactly same thing.
  • models.GetRecentUpdatedRepositories() doesn't make sense, as it is used only if query parameter q is empty and can return results with different ordering (not "recent updated"). models.SearchRepositoryByName() should do same thing.

Bonus: less code to maintain, less space for bugs :)

Extracted from #2371 and further improved.


🔄 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/2652 **Author:** [@Morlinest](https://github.com/Morlinest) **Created:** 10/4/2017 **Status:** ✅ Merged **Merged:** 10/10/2017 **Merged by:** [@bkcsoft](https://github.com/bkcsoft) **Base:** `master` ← **Head:** `fix/use-same-function-for-repo-search` --- ### 📝 Commits (5) - [`7570ff4`](https://github.com/go-gitea/gitea/commit/7570ff4f52b4a4bc4c958953cb8907c361cc197f) Remove redudant functions and code - [`69c23f2`](https://github.com/go-gitea/gitea/commit/69c23f216e74c9d5332f921ceb7f3c6117ff4e61) Lowercase column names - [`82b6465`](https://github.com/go-gitea/gitea/commit/82b64659c77a91184511d57a121a68821c5378c8) Remove Searcher field - [`ceb8174`](https://github.com/go-gitea/gitea/commit/ceb8174e77c0b356ab75a88ead30af13094da2a1) Include all public repositories in search result - [`d3e349b`](https://github.com/go-gitea/gitea/commit/d3e349b7825651ef05639cf7ff0f60403c8c47ec) Add unit tests ### 📊 Changes **5 files changed** (+57 additions, -117 deletions) <details> <summary>View changed files</summary> 📝 `models/issue_indexer.go` (+3 -1) 📝 `models/repo_list.go` (+12 -80) 📝 `models/repo_list_test.go` (+19 -1) 📝 `routers/admin/repos.go` (+0 -1) 📝 `routers/home.go` (+23 -34) </details> ### 📄 Description Remove useless functions/code. Fixes multiple bugs and remove duplicated code, like: - Corrects ordering of repositories on admin page - Corrects results when searching (explore page) - now you can get 2 different results when searching with/without keyword because two different functions are used and implementation is not same for both. But results with non empty keyword should always contains subset of full search (empty keyword) results. - `models.Repositories()` ignores privacy settings in search but uses it for `count` (even it's always true as it is used only in 1 place with fixed privacy settings). This function can be replaced by `models.SearchRepositoryByName()` as it does exactly same thing. - `models.GetRecentUpdatedRepositories()` doesn't make sense, as it is used only if query parameter `q` is empty and can return results with different ordering (not "recent updated"). `models.SearchRepositoryByName()` should do same thing. Bonus: less code to maintain, less space for bugs :) Extracted from #2371 and further improved. --- <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:40 -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#16525