Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Show empty repos in Admin Repository Management page (#23114) #23129

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions routers/web/admin/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ func Repos(ctx *context.Context) {
ctx.Data["PageIsAdminRepositories"] = true

explore.RenderRepoSearch(ctx, &explore.RepoSearchOptions{
Private: true,
PageSize: setting.UI.Admin.RepoPagingNum,
TplName: tplRepos,
Private: true,
PageSize: setting.UI.Admin.RepoPagingNum,
TplName: tplRepos,
OnlyShowRelevant: false,
})
}

Expand Down
35 changes: 19 additions & 16 deletions routers/web/explore/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ const (

// RepoSearchOptions when calling search repositories
type RepoSearchOptions struct {
OwnerID int64
Private bool
Restricted bool
PageSize int
TplName base.TplName
OwnerID int64
Private bool
Restricted bool
PageSize int
OnlyShowRelevant bool
TplName base.TplName
}

// RenderRepoSearch render repositories search page
// This function is also used to render the Admin Repository Management page.
// The isAdmin param should be set to true when rendering the Admin page.
func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
// Sitemap index for sitemap paths
page := int(ctx.ParamsInt64("idx"))
Expand All @@ -48,11 +51,10 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
}

var (
repos []*repo_model.Repository
count int64
err error
orderBy db.SearchOrderBy
onlyShowRelevant bool
repos []*repo_model.Repository
count int64
err error
orderBy db.SearchOrderBy
)

ctx.Data["SortType"] = ctx.FormString("sort")
Expand Down Expand Up @@ -90,7 +92,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
onlyShowRelevant = false
}

ctx.Data["OnlyShowRelevant"] = onlyShowRelevant
ctx.Data["OnlyShowRelevant"] = opts.OnlyShowRelevant

topicOnly := ctx.FormBool("topic")
ctx.Data["TopicOnly"] = topicOnly
Expand All @@ -113,7 +115,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
TopicOnly: topicOnly,
Language: language,
IncludeDescription: setting.UI.SearchRepoDescription,
OnlyShowRelevant: onlyShowRelevant,
OnlyShowRelevant: opts.OnlyShowRelevant,
})
if err != nil {
ctx.ServerError("SearchRepository", err)
Expand Down Expand Up @@ -160,9 +162,10 @@ func Repos(ctx *context.Context) {
}

RenderRepoSearch(ctx, &RepoSearchOptions{
PageSize: setting.UI.ExplorePagingNum,
OwnerID: ownerID,
Private: ctx.Doer != nil,
TplName: tplExploreRepos,
PageSize: setting.UI.ExplorePagingNum,
OwnerID: ownerID,
Private: ctx.Doer != nil,
TplName: tplExploreRepos,
OnlyShowRelevant: !ctx.FormBool(relevantReposOnlyParam),
})
}