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>
This commit is contained in:
delvh 2023-02-04 14:26:38 +01:00 committed by GitHub
parent ea13b23349
commit 4d20a4a1ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 18 deletions

View file

@ -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)