|
|
|
@ -51,8 +51,8 @@ func getDashboardContextUser(ctx *middleware.Context) *models.User {
|
|
|
|
|
return ctxUser |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func retrieveFeeds(ctx *middleware.Context, uid, offset int64, isProfile bool) { |
|
|
|
|
actions, err := models.GetFeeds(uid, offset, isProfile) |
|
|
|
|
func retrieveFeeds(ctx *middleware.Context, ctxUserID, userID, offset int64, isProfile bool) { |
|
|
|
|
actions, err := models.GetFeeds(ctxUserID, userID, offset, isProfile) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Handle(500, "GetFeeds", err) |
|
|
|
|
return |
|
|
|
@ -109,18 +109,28 @@ func Dashboard(ctx *middleware.Context) {
|
|
|
|
|
ctx.Data["CollaborativeRepos"] = collaborateRepos |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
repos, err := models.GetRepositories(ctxUser.Id, true) |
|
|
|
|
var repos []*models.Repository |
|
|
|
|
if ctxUser.IsOrganization() { |
|
|
|
|
if err := ctxUser.GetUserRepositories(ctx.User.Id); err != nil { |
|
|
|
|
ctx.Handle(500, "GetUserRepositories", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
repos = ctxUser.Repos |
|
|
|
|
} else { |
|
|
|
|
var err error |
|
|
|
|
repos, err = models.GetRepositories(ctxUser.Id, true) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Handle(500, "GetRepositories", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ctx.Data["Repos"] = repos |
|
|
|
|
|
|
|
|
|
// Get mirror repositories.
|
|
|
|
|
mirrors := make([]*models.Repository, 0, 5) |
|
|
|
|
for _, repo := range repos { |
|
|
|
|
if repo.IsMirror { |
|
|
|
|
if err = repo.GetMirror(); err != nil { |
|
|
|
|
if err := repo.GetMirror(); err != nil { |
|
|
|
|
ctx.Handle(500, "GetMirror: "+repo.Name, err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -130,7 +140,7 @@ func Dashboard(ctx *middleware.Context) {
|
|
|
|
|
ctx.Data["MirrorCount"] = len(mirrors) |
|
|
|
|
ctx.Data["Mirrors"] = mirrors |
|
|
|
|
|
|
|
|
|
retrieveFeeds(ctx, ctxUser.Id, 0, false) |
|
|
|
|
retrieveFeeds(ctx, ctx.User.Id, ctxUser.Id, 0, false) |
|
|
|
|
if ctx.Written() { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|