Browse Source

[GINR] Repos with hideme should not be explored

cgars 7 năm trước cách đây
mục cha
commit
00f74d2405
2 tập tin đã thay đổi với 11 bổ sung1 xóa
  1. 10 1
      routes/home.go
  2. 1 0
      routes/user/home.go

+ 10 - 1
routes/home.go

@@ -11,6 +11,7 @@ import (
 	"github.com/G-Node/gogs/pkg/context"
 	"github.com/G-Node/gogs/pkg/setting"
 	"github.com/G-Node/gogs/routes/user"
+	"strings"
 )
 
 const (
@@ -72,7 +73,15 @@ func ExploreRepos(c *context.Context) {
 		c.Handle(500, "LoadAttributes", err)
 		return
 	}
-	c.Data["Repos"] = repos
+	// filter repos we eant to not show in list
+	var showRep []*models.Repository
+	for _, repo := range repos {
+		if !strings.Contains(repo.Name, "hideme") {
+			showRep = append(showRep, repo)
+		}
+	}
+
+	c.Data["Repos"] = showRep
 
 	c.HTML(200, EXPLORE_REPOS)
 }

+ 1 - 0
routes/user/home.go

@@ -92,6 +92,7 @@ func retrieveFeeds(c *context.Context, ctxUser *models.User, userID int64, isPro
 		case strings.Contains(act.RepoName, "hideme"):
 			log.Trace("Ignored Ref %s for feed", act.RefName)
 		default:
+			log.Trace("Added Ref %s for feed", act.RefName)
 			feeds = append(feeds, act)
 		}
 	}