summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-13 17:37:02 -0500
committerUnknwon <u@gogs.io>2015-11-13 17:37:02 -0500
commitf8ae161c743f3249e4b580cddc46da41b98652a9 (patch)
tree1bb44bd477ab0a23313c68bd1309b2a68bfffd67 /routers/user
parent1d57f0d64fcd9aec16b4003d5664f31ea748da03 (diff)
downloadgitea-f8ae161c743f3249e4b580cddc46da41b98652a9.tar.gz
gitea-f8ae161c743f3249e4b580cddc46da41b98652a9.zip
fix #1302
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/home.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/routers/user/home.go b/routers/user/home.go
index fc94dfc9e2..b98d7e1157 100644
--- a/routers/user/home.go
+++ b/routers/user/home.go
@@ -62,23 +62,21 @@ func Dashboard(ctx *middleware.Context) {
return
}
- // Check context type.
if !ctxUser.IsOrganization() {
- // Normal user.
- ctxUser = ctx.User
- collaborates, err := ctx.User.GetAccessibleRepositories()
+ collaborateRepos, err := ctx.User.GetAccessibleRepositories()
if err != nil {
ctx.Handle(500, "GetAccessibleRepositories", err)
return
}
- repositories := make([]*models.Repository, 0, len(collaborates))
- for repo := range collaborates {
- repositories = append(repositories, repo)
+ for i := range collaborateRepos {
+ if err = collaborateRepos[i].GetOwner(); err != nil {
+ ctx.Handle(500, "GetOwner: "+collaborateRepos[i].Name, err)
+ return
+ }
}
-
- ctx.Data["CollaborateCount"] = len(repositories)
- ctx.Data["CollaborativeRepos"] = repositories
+ ctx.Data["CollaborateCount"] = len(collaborateRepos)
+ ctx.Data["CollaborativeRepos"] = collaborateRepos
}
repos, err := models.GetRepositories(ctxUser.Id, true)
@@ -89,7 +87,7 @@ func Dashboard(ctx *middleware.Context) {
ctx.Data["Repos"] = repos
// Get mirror repositories.
- mirrors := make([]*models.Repository, 0, len(repos)/2)
+ mirrors := make([]*models.Repository, 0, 5)
for _, repo := range repos {
if repo.IsMirror {
if err = repo.GetMirror(); err != nil {