Remove fetch request from heatmap (#13623)
* Remove fetch request from heatmap Render heatmap data directly to HTML, eliminating one HTTP request on frontpage and user profile. Also added min-height to the container so the page content will no longer move after loading. * rename and error display * also log the js error * add error handler * remove useless inline style and hide divider on small screens * Update routers/user/home.go * Update routers/user/profile.go
This commit is contained in:
parent
d02c3508e6
commit
12c2efb45c
11 changed files with 90 additions and 78 deletions
|
@ -114,8 +114,14 @@ func Dashboard(ctx *context.Context) {
|
|||
ctx.Data["SearchLimit"] = setting.UI.User.RepoPagingNum
|
||||
// no heatmap access for admins; GetUserHeatmapDataByUser ignores the calling user
|
||||
// so everyone would get the same empty heatmap
|
||||
ctx.Data["EnableHeatmap"] = setting.Service.EnableUserHeatmap && !ctxUser.KeepActivityPrivate
|
||||
ctx.Data["HeatmapUser"] = ctxUser.Name
|
||||
if setting.Service.EnableUserHeatmap && !ctxUser.KeepActivityPrivate {
|
||||
data, err := models.GetUserHeatmapDataByUser(ctxUser)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserHeatmapDataByUser", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["HeatmapData"] = data
|
||||
}
|
||||
|
||||
var err error
|
||||
var mirrors []*models.Repository
|
||||
|
|
|
@ -94,10 +94,18 @@ func Profile(ctx *context.Context) {
|
|||
ctx.Data["PageIsUserProfile"] = true
|
||||
ctx.Data["Owner"] = ctxUser
|
||||
ctx.Data["OpenIDs"] = openIDs
|
||||
|
||||
// no heatmap access for admins; GetUserHeatmapDataByUser ignores the calling user
|
||||
// so everyone would get the same empty heatmap
|
||||
ctx.Data["EnableHeatmap"] = setting.Service.EnableUserHeatmap && !ctxUser.KeepActivityPrivate
|
||||
ctx.Data["HeatmapUser"] = ctxUser.Name
|
||||
if setting.Service.EnableUserHeatmap && !ctxUser.KeepActivityPrivate {
|
||||
data, err := models.GetUserHeatmapDataByUser(ctxUser)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserHeatmapDataByUser", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["HeatmapData"] = data
|
||||
}
|
||||
|
||||
if len(ctxUser.Description) != 0 {
|
||||
ctx.Data["RenderedDescription"] = string(markdown.Render([]byte(ctxUser.Description), ctx.Repo.RepoLink, map[string]string{"mode": "document"}))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue