mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Only activity tab needs heatmap data loading (#34652)
This commit is contained in:
		@@ -63,17 +63,6 @@ func userProfile(ctx *context.Context) {
 | 
				
			|||||||
	ctx.Data["Title"] = ctx.ContextUser.DisplayName()
 | 
						ctx.Data["Title"] = ctx.ContextUser.DisplayName()
 | 
				
			||||||
	ctx.Data["PageIsUserProfile"] = true
 | 
						ctx.Data["PageIsUserProfile"] = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// prepare heatmap data
 | 
					 | 
				
			||||||
	if setting.Service.EnableUserHeatmap {
 | 
					 | 
				
			||||||
		data, err := activities_model.GetUserHeatmapDataByUser(ctx, ctx.ContextUser, ctx.Doer)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			ctx.ServerError("GetUserHeatmapDataByUser", err)
 | 
					 | 
				
			||||||
			return
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		ctx.Data["HeatmapData"] = data
 | 
					 | 
				
			||||||
		ctx.Data["HeatmapTotalContributions"] = activities_model.GetTotalContributionsInHeatmap(data)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	profileDbRepo, profileReadmeBlob := shared_user.FindOwnerProfileReadme(ctx, ctx.Doer)
 | 
						profileDbRepo, profileReadmeBlob := shared_user.FindOwnerProfileReadme(ctx, ctx.Doer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	prepareUserProfileTabData(ctx, profileDbRepo, profileReadmeBlob)
 | 
						prepareUserProfileTabData(ctx, profileDbRepo, profileReadmeBlob)
 | 
				
			||||||
@@ -172,6 +161,17 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
 | 
				
			|||||||
		ctx.Data["Cards"] = following
 | 
							ctx.Data["Cards"] = following
 | 
				
			||||||
		total = int(numFollowing)
 | 
							total = int(numFollowing)
 | 
				
			||||||
	case "activity":
 | 
						case "activity":
 | 
				
			||||||
 | 
							// prepare heatmap data
 | 
				
			||||||
 | 
							if setting.Service.EnableUserHeatmap {
 | 
				
			||||||
 | 
								data, err := activities_model.GetUserHeatmapDataByUser(ctx, ctx.ContextUser, ctx.Doer)
 | 
				
			||||||
 | 
								if err != nil {
 | 
				
			||||||
 | 
									ctx.ServerError("GetUserHeatmapDataByUser", err)
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								ctx.Data["HeatmapData"] = data
 | 
				
			||||||
 | 
								ctx.Data["HeatmapTotalContributions"] = activities_model.GetTotalContributionsInHeatmap(data)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		date := ctx.FormString("date")
 | 
							date := ctx.FormString("date")
 | 
				
			||||||
		pagingNum = setting.UI.FeedPagingNum
 | 
							pagingNum = setting.UI.FeedPagingNum
 | 
				
			||||||
		showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
 | 
							showPrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user