org/dashboard: fix wrong repository count (#4351)
Should not include count for inaccessible repositories.master
parent
cf7d5d0c56
commit
11ffdac3f8
2
gogs.go
2
gogs.go
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"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() {
|
func init() {
|
||||||
setting.AppVer = APP_VER
|
setting.AppVer = APP_VER
|
||||||
|
|
|
@ -124,8 +124,9 @@ func Dashboard(ctx *context.Context) {
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var repos, mirrors []*models.Repository
|
var repos, mirrors []*models.Repository
|
||||||
|
var repoCount int64
|
||||||
if ctxUser.IsOrganization() {
|
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 {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserRepositories", err)
|
ctx.Handle(500, "GetUserRepositories", err)
|
||||||
return
|
return
|
||||||
|
@ -142,6 +143,7 @@ func Dashboard(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
repos = ctxUser.Repos
|
repos = ctxUser.Repos
|
||||||
|
repoCount = int64(ctxUser.NumRepos)
|
||||||
|
|
||||||
mirrors, err = ctxUser.GetMirrorRepositories()
|
mirrors, err = ctxUser.GetMirrorRepositories()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -150,6 +152,7 @@ func Dashboard(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.Data["Repos"] = repos
|
ctx.Data["Repos"] = repos
|
||||||
|
ctx.Data["RepoCount"] = repoCount
|
||||||
ctx.Data["MaxShowRepoNum"] = setting.UI.User.RepoPagingNum
|
ctx.Data["MaxShowRepoNum"] = setting.UI.User.RepoPagingNum
|
||||||
|
|
||||||
if err := models.MirrorRepositoryList(mirrors).LoadAttributes(); err != nil {
|
if err := models.MirrorRepositoryList(mirrors).LoadAttributes(); err != nil {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.10.31.0327 / 0.11 RC
|
0.10.32.0328 / 0.11 RC
|
|
@ -19,7 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ui tab active list" data-tab="repos">
|
<div class="ui tab active list" data-tab="repos">
|
||||||
<h4 class="ui top attached header">
|
<h4 class="ui top attached header">
|
||||||
{{.i18n.Tr "home.my_repos"}} <span class="ui grey label">{{.ContextUser.NumRepos}}</span>
|
{{.i18n.Tr "home.my_repos"}} <span class="ui grey label">{{.RepoCount}}</span>
|
||||||
<div class="ui right">
|
<div class="ui right">
|
||||||
<a class="poping up" href="{{AppSubUrl}}/repo/create{{if .ContextUser.IsOrganization}}?org={{.ContextUser.ID}}{{end}}" data-content="{{.i18n.Tr "new_repo"}}" data-variation="tiny inverted" data-position="left center">
|
<a class="poping up" href="{{AppSubUrl}}/repo/create{{if .ContextUser.IsOrganization}}?org={{.ContextUser.ID}}{{end}}" data-content="{{.i18n.Tr "new_repo"}}" data-variation="tiny inverted" data-position="left center">
|
||||||
<i class="plus icon"></i>
|
<i class="plus icon"></i>
|
||||||
|
|
Loading…
Reference in New Issue