diff options
author | delvh <leon@kske.dev> | 2023-02-04 14:26:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-04 21:26:38 +0800 |
commit | 4d20a4a1baeb9ed1bb5b3ed7c44b6046f6387303 (patch) | |
tree | 739c75ed66f8ba185af6f5657a1444c65eb64ab5 /routers/web/explore | |
parent | ea13b23349ef98249deeb9469f6b1444de42abf5 (diff) | |
download | gitea-4d20a4a1baeb9ed1bb5b3ed7c44b6046f6387303.tar.gz gitea-4d20a4a1baeb9ed1bb5b3ed7c44b6046f6387303.zip |
Remove ONLY_SHOW_RELEVANT_REPOS setting (#21962)
Every user can already disable the filter manually, so the explicit
setting is absolutely useless and only complicates the logic.
Previously, there was also unexpected behavior when multiple query
parameters were present.
---------
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/web/explore')
-rw-r--r-- | routers/web/explore/repo.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/routers/web/explore/repo.go b/routers/web/explore/repo.go index 5271e39bbc..e9684dd286 100644 --- a/routers/web/explore/repo.go +++ b/routers/web/explore/repo.go @@ -17,7 +17,8 @@ import ( const ( // tplExploreRepos explore repositories page template - tplExploreRepos base.TplName = "explore/repos" + tplExploreRepos base.TplName = "explore/repos" + relevantReposOnlyParam string = "no_filter" ) // RepoSearchOptions when calling search repositories @@ -81,13 +82,11 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { default: ctx.Data["SortType"] = "recentupdate" orderBy = db.SearchOrderByRecentUpdated - onlyShowRelevant = setting.UI.OnlyShowRelevantRepos && !ctx.FormBool("no_filter") } + onlyShowRelevant = !ctx.FormBool(relevantReposOnlyParam) + keyword := ctx.FormTrim("q") - if keyword != "" { - onlyShowRelevant = false - } ctx.Data["OnlyShowRelevant"] = onlyShowRelevant @@ -139,7 +138,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { pager.SetDefaultParams(ctx) pager.AddParam(ctx, "topic", "TopicOnly") pager.AddParam(ctx, "language", "Language") - pager.AddParamString("no_filter", ctx.FormString("no_filter")) + pager.AddParamString(relevantReposOnlyParam, ctx.FormString(relevantReposOnlyParam)) ctx.Data["Page"] = pager ctx.HTML(http.StatusOK, opts.TplName) |