Skip to content

Commit 2df2b11

Browse files
committed
Hide mirrors from explore view
1 parent 6d0e4f5 commit 2df2b11

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

routers/home.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func Home(ctx *context.Context) {
7373
// RepoSearchOptions when calling search repositories
7474
type RepoSearchOptions struct {
7575
OwnerID int64
76+
HideMirror util.OptionalBool
7677
Private bool
7778
Restricted bool
7879
PageSize int
@@ -136,6 +137,12 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
136137
topicOnly := ctx.QueryBool("topic")
137138
ctx.Data["TopicOnly"] = topicOnly
138139

140+
var show_mirror util.OptionalBool = util.OptionalBoolNone;
141+
142+
if ((opts.HideMirror == util.OptionalBoolTrue) && (keyword == "")) {
143+
show_mirror = util.OptionalBoolFalse;
144+
}
145+
139146
repos, count, err = models.SearchRepository(&models.SearchRepoOptions{
140147
ListOptions: models.ListOptions{
141148
Page: page,
@@ -144,6 +151,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
144151
Actor: ctx.User,
145152
OrderBy: orderBy,
146153
Private: opts.Private,
154+
Mirror: show_mirror,
147155
Keyword: keyword,
148156
OwnerID: opts.OwnerID,
149157
AllPublic: true,
@@ -181,6 +189,7 @@ func ExploreRepos(ctx *context.Context) {
181189
}
182190

183191
RenderRepoSearch(ctx, &RepoSearchOptions{
192+
HideMirror: util.OptionalBoolTrue,
184193
PageSize: setting.UI.ExplorePagingNum,
185194
OwnerID: ownerID,
186195
Private: ctx.User != nil,

0 commit comments

Comments
 (0)