Skip to content

Commit 254c4c7

Browse files
author
Gusted
committed
Add control logic
1 parent 8bff6db commit 254c4c7

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

custom/conf/app.example.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,10 @@ PATH =
11331133
;;
11341134
;; Whether to enable a Service Worker to cache frontend assets
11351135
;USE_SERVICE_WORKER = false
1136+
;;
1137+
;; Whether to only show relevant repo's on the explore page(when no keyword is specified and default sorting is used).
1138+
;; A repo is considered to be irrelevant if it's a fork or doesn't have a description or topic.
1139+
;HIDE_IRRELEVANT_REPOS = false
11361140

11371141
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11381142
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ The following configuration set `Content-Type: application/vnd.android.package-a
190190
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
191191
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
192192
- `USE_SERVICE_WORKER`: **false**: Whether to enable a Service Worker to cache frontend assets.
193+
- `HIDE_IRRELEVANT_REPOS`: **false** Whether to only show relevant repo's on the explore page(when no keyword is specified and default sorting is used).
194+
A repo is considered to be irrelevant if it's a fork or doesn't have a description or topic.
193195

194196
### UI - Admin (`ui.admin`)
195197

modules/setting/setting.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ var (
228228
CustomEmojisMap map[string]string `ini:"-"`
229229
SearchRepoDescription bool
230230
UseServiceWorker bool
231+
HideIrrelevantRepo bool
231232

232233
Notification struct {
233234
MinTimeout time.Duration
@@ -1069,6 +1070,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
10691070
UI.DefaultShowFullName = Cfg.Section("ui").Key("DEFAULT_SHOW_FULL_NAME").MustBool(false)
10701071
UI.SearchRepoDescription = Cfg.Section("ui").Key("SEARCH_REPO_DESCRIPTION").MustBool(true)
10711072
UI.UseServiceWorker = Cfg.Section("ui").Key("USE_SERVICE_WORKER").MustBool(false)
1073+
UI.HideIrrelevantRepo = Cfg.Section("ui").Key("HIDE_IRRELEVANT_REPOS").MustBool(false)
10721074

10731075
HasRobotsTxt, err = util.IsFile(path.Join(CustomPath, "robots.txt"))
10741076
if err != nil {

routers/web/explore/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
7373
default:
7474
ctx.Data["SortType"] = "recentupdate"
7575
orderBy = db.SearchOrderByRecentUpdated
76-
onlyShowRelevant = !ctx.FormBool("no_filter")
76+
onlyShowRelevant = setting.UI.HideIrrelevantRepo && !ctx.FormBool("no_filter")
7777
}
7878

7979
keyword := ctx.FormTrim("q")

0 commit comments

Comments
 (0)