diff options
Diffstat (limited to 'routers/web/user/home.go')
-rw-r--r-- | routers/web/user/home.go | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/routers/web/user/home.go b/routers/web/user/home.go index d2b67e6e59..959b1aa1e9 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -25,6 +25,7 @@ import ( "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/routers/web/feed" issue_service "code.gitea.io/gitea/services/issue" pull_service "code.gitea.io/gitea/services/pull" @@ -60,42 +61,6 @@ func getDashboardContextUser(ctx *context.Context) *models.User { return ctxUser } -// retrieveFeeds loads feeds for the specified user -func retrieveFeeds(ctx *context.Context, options models.GetFeedsOptions) { - actions, err := models.GetFeeds(options) - if err != nil { - ctx.ServerError("GetFeeds", err) - return - } - - userCache := map[int64]*models.User{options.RequestedUser.ID: options.RequestedUser} - if ctx.User != nil { - userCache[ctx.User.ID] = ctx.User - } - for _, act := range actions { - if act.ActUser != nil { - userCache[act.ActUserID] = act.ActUser - } - } - - for _, act := range actions { - repoOwner, ok := userCache[act.Repo.OwnerID] - if !ok { - repoOwner, err = models.GetUserByID(act.Repo.OwnerID) - if err != nil { - if models.IsErrUserNotExist(err) { - continue - } - ctx.ServerError("GetUserByID", err) - return - } - userCache[repoOwner.ID] = repoOwner - } - act.Repo.Owner = repoOwner - } - ctx.Data["Feeds"] = actions -} - // Dashboard render the dashboard page func Dashboard(ctx *context.Context) { ctxUser := getDashboardContextUser(ctx) @@ -154,7 +119,7 @@ func Dashboard(ctx *context.Context) { ctx.Data["MirrorCount"] = len(mirrors) ctx.Data["Mirrors"] = mirrors - retrieveFeeds(ctx, models.GetFeedsOptions{ + ctx.Data["Feeds"] = feed.RetrieveFeeds(ctx, models.GetFeedsOptions{ RequestedUser: ctxUser, RequestedTeam: ctx.Org.Team, Actor: ctx.User, @@ -167,6 +132,7 @@ func Dashboard(ctx *context.Context) { if ctx.Written() { return } + ctx.HTML(http.StatusOK, tplDashboard) } |