From 11ffdac3f8749a14316dc115bb1a376efe8186eb Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 28 Mar 2017 11:16:29 -0400 Subject: org/dashboard: fix wrong repository count (#4351) Should not include count for inaccessible repositories. --- gogs.go | 2 +- routers/user/home.go | 5 ++++- templates/.VERSION | 2 +- templates/user/dashboard/dashboard.tmpl | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gogs.go b/gogs.go index 99fe2d34..cd5cc73c 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.10.31.0327 / 0.11 RC" +const APP_VER = "0.10.32.0328 / 0.11 RC" func init() { setting.AppVer = APP_VER diff --git a/routers/user/home.go b/routers/user/home.go index 2fe70c43..ce8c2243 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -124,8 +124,9 @@ func Dashboard(ctx *context.Context) { var err error var repos, mirrors []*models.Repository + var repoCount int64 if ctxUser.IsOrganization() { - repos, _, err = ctxUser.GetUserRepositories(ctx.User.ID, 1, setting.UI.User.RepoPagingNum) + repos, repoCount, err = ctxUser.GetUserRepositories(ctx.User.ID, 1, setting.UI.User.RepoPagingNum) if err != nil { ctx.Handle(500, "GetUserRepositories", err) return @@ -142,6 +143,7 @@ func Dashboard(ctx *context.Context) { return } repos = ctxUser.Repos + repoCount = int64(ctxUser.NumRepos) mirrors, err = ctxUser.GetMirrorRepositories() if err != nil { @@ -150,6 +152,7 @@ func Dashboard(ctx *context.Context) { } } ctx.Data["Repos"] = repos + ctx.Data["RepoCount"] = repoCount ctx.Data["MaxShowRepoNum"] = setting.UI.User.RepoPagingNum if err := models.MirrorRepositoryList(mirrors).LoadAttributes(); err != nil { diff --git a/templates/.VERSION b/templates/.VERSION index 8c93e059..b755053b 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.10.31.0327 / 0.11 RC \ No newline at end of file +0.10.32.0328 / 0.11 RC \ No newline at end of file diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl index 40c6b2dd..978b0bc7 100644 --- a/templates/user/dashboard/dashboard.tmpl +++ b/templates/user/dashboard/dashboard.tmpl @@ -19,7 +19,7 @@

- {{.i18n.Tr "home.my_repos"}} {{.ContextUser.NumRepos}} + {{.i18n.Tr "home.my_repos"}} {{.RepoCount}}