diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-10-16 18:22:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 00:22:34 +0800 |
commit | cad9adeff41595ea32281dbc2918e653c3e3a839 (patch) | |
tree | a62bf796f12655c85323ded8922c6ea1d5e256ed /routers/web/repo/webhook.go | |
parent | 6f48a36227b7427afd2020aa416afe49d4c81015 (diff) | |
download | gitea-cad9adeff41595ea32281dbc2918e653c3e3a839.tar.gz gitea-cad9adeff41595ea32281dbc2918e653c3e3a839.zip |
Display total commit count in hook message (#21400)
Fixes #21379
The commits are capped by `setting.UI.FeedMaxCommitNum` so
`len(commits)` is not the correct number. So this PR adds a new
`TotalCommits` field.
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/web/repo/webhook.go')
-rw-r--r-- | routers/web/repo/webhook.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go index a8939e72bd..425198ce24 100644 --- a/routers/web/repo/webhook.go +++ b/routers/web/repo/webhook.go @@ -668,15 +668,16 @@ func TestWebhook(ctx *context.Context) { commitID := commit.ID.String() p := &api.PushPayload{ - Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch, - Before: commitID, - After: commitID, - CompareURL: setting.AppURL + ctx.Repo.Repository.ComposeCompareURL(commitID, commitID), - Commits: []*api.PayloadCommit{apiCommit}, - HeadCommit: apiCommit, - Repo: convert.ToRepo(ctx.Repo.Repository, perm.AccessModeNone), - Pusher: apiUser, - Sender: apiUser, + Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch, + Before: commitID, + After: commitID, + CompareURL: setting.AppURL + ctx.Repo.Repository.ComposeCompareURL(commitID, commitID), + Commits: []*api.PayloadCommit{apiCommit}, + TotalCommits: 1, + HeadCommit: apiCommit, + Repo: convert.ToRepo(ctx.Repo.Repository, perm.AccessModeNone), + Pusher: apiUser, + Sender: apiUser, } if err := webhook_service.PrepareWebhook(w, ctx.Repo.Repository, webhook.HookEventPush, p); err != nil { ctx.Flash.Error("PrepareWebhook: " + err.Error()) |