Add comment for the design of "user activity time" (#37195)

This commit is contained in:
wxiaoguang
2026-04-14 04:01:29 +08:00
committed by GitHub
parent 37396fff13
commit 0593b58ff7
3 changed files with 8 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ func getUserHeatmapData(ctx context.Context, user *user_model.User, team *organi
return nil, err
}
// HINT: USER-ACTIVITY-PUSH-COMMITS: it only uses the doer's action time, it doesn't use git commit's time
return hdata, db.GetEngine(ctx).
Select(groupBy+" AS timestamp, count(user_id) as contributions").
Table("action").

View File

@@ -327,7 +327,7 @@ func (a *actionNotifier) PushCommits(ctx context.Context, pusher *user_model.Use
opType := activities_model.ActionCommitRepo
// Check it's tag push or branch.
// Check its tag push or branch.
if opts.RefFullName.IsTag() {
opType = activities_model.ActionPushTag
if opts.IsDelRef() {
@@ -337,6 +337,11 @@ func (a *actionNotifier) PushCommits(ctx context.Context, pusher *user_model.Use
opType = activities_model.ActionDeleteBranch
}
// HINT: USER-ACTIVITY-PUSH-COMMITS: it's said that the time of push commits (for user activity display) is designed this way,
// it doesn't use git commit's time, it only uses the doer's action time.
// ref: https://github.com/go-gitea/gitea/pull/36469#issuecomment-3901955347
// ref: https://github.com/go-gitea/gitea/issues/14051
// ref: https://github.com/go-gitea/gitea/issues/11861#issuecomment-643162143
if err = NotifyWatchers(ctx, &activities_model.Action{
ActUserID: pusher.ID,
ActUser: pusher,

View File

@@ -1,4 +1,5 @@
{{if .EnableHeatmap}}
{{/*HINT: USER-ACTIVITY-PUSH-COMMITS: it only uses the doer's action time, it doesn't use git commit's time */}}
<div class="activity-heatmap-container">
<div id="user-heatmap" class="is-loading"
data-heatmap-url="{{.HeatmapURL}}"