Filter Repositories by type (#29231)

Filter Repositories by type (resolves #1170, #1318)

before:

![image](74e6be62-9010-4ab4-8f9b-bd8afbebb8fb)

after:

![image](e4d85ed6-7864-4150-8d72-5194dac1293f)

(cherry picked from commit e3524c63d6d42865ea8288af89b372544d35474b)
This commit is contained in:
Tim-Niclas Oelschläger 2024-03-03 11:18:34 +01:00 committed by Earl Warren
parent a39f69ac28
commit 83e04328df
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
15 changed files with 200 additions and 79 deletions

View file

@ -85,6 +85,21 @@ func Home(ctx *context.Context) {
page = 1
}
archived := ctx.FormOptionalBool("archived")
ctx.Data["IsArchived"] = archived
fork := ctx.FormOptionalBool("fork")
ctx.Data["IsFork"] = fork
mirror := ctx.FormOptionalBool("mirror")
ctx.Data["IsMirror"] = mirror
template := ctx.FormOptionalBool("template")
ctx.Data["IsTemplate"] = template
private := ctx.FormOptionalBool("private")
ctx.Data["IsPrivate"] = private
var (
repos []*repo_model.Repository
count int64
@ -102,6 +117,11 @@ func Home(ctx *context.Context) {
Actor: ctx.Doer,
Language: language,
IncludeDescription: setting.UI.SearchRepoDescription,
Archived: archived,
Fork: fork,
Mirror: mirror,
Template: template,
IsPrivate: private,
})
if err != nil {
ctx.ServerError("SearchRepository", err)