@@ -23,14 +23,17 @@ const (
23
23
24
24
// RepoSearchOptions when calling search repositories
25
25
type RepoSearchOptions struct {
26
- OwnerID int64
27
- Private bool
28
- Restricted bool
29
- PageSize int
30
- TplName base.TplName
26
+ OwnerID int64
27
+ Private bool
28
+ Restricted bool
29
+ PageSize int
30
+ OnlyShowRelevant bool
31
+ TplName base.TplName
31
32
}
32
33
33
34
// RenderRepoSearch render repositories search page
35
+ // This function is also used to render the Admin Repository Management page.
36
+ // The isAdmin param should be set to true when rendering the Admin page.
34
37
func RenderRepoSearch (ctx * context.Context , opts * RepoSearchOptions ) {
35
38
// Sitemap index for sitemap paths
36
39
page := int (ctx .ParamsInt64 ("idx" ))
@@ -48,11 +51,10 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
48
51
}
49
52
50
53
var (
51
- repos []* repo_model.Repository
52
- count int64
53
- err error
54
- orderBy db.SearchOrderBy
55
- onlyShowRelevant bool
54
+ repos []* repo_model.Repository
55
+ count int64
56
+ err error
57
+ orderBy db.SearchOrderBy
56
58
)
57
59
58
60
ctx .Data ["SortType" ] = ctx .FormString ("sort" )
@@ -90,7 +92,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
90
92
onlyShowRelevant = false
91
93
}
92
94
93
- ctx .Data ["OnlyShowRelevant" ] = onlyShowRelevant
95
+ ctx .Data ["OnlyShowRelevant" ] = opts . OnlyShowRelevant
94
96
95
97
topicOnly := ctx .FormBool ("topic" )
96
98
ctx .Data ["TopicOnly" ] = topicOnly
@@ -113,7 +115,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
113
115
TopicOnly : topicOnly ,
114
116
Language : language ,
115
117
IncludeDescription : setting .UI .SearchRepoDescription ,
116
- OnlyShowRelevant : onlyShowRelevant ,
118
+ OnlyShowRelevant : opts . OnlyShowRelevant ,
117
119
})
118
120
if err != nil {
119
121
ctx .ServerError ("SearchRepository" , err )
@@ -160,9 +162,10 @@ func Repos(ctx *context.Context) {
160
162
}
161
163
162
164
RenderRepoSearch (ctx , & RepoSearchOptions {
163
- PageSize : setting .UI .ExplorePagingNum ,
164
- OwnerID : ownerID ,
165
- Private : ctx .Doer != nil ,
166
- TplName : tplExploreRepos ,
165
+ PageSize : setting .UI .ExplorePagingNum ,
166
+ OwnerID : ownerID ,
167
+ Private : ctx .Doer != nil ,
168
+ TplName : tplExploreRepos ,
169
+ OnlyShowRelevant : ! ctx .FormBool (relevantReposOnlyParam ),
167
170
})
168
171
}
0 commit comments