mirror of
https://github.com/go-gitea/gitea
synced 2025-07-14 22:47:21 +00:00
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>
This commit is contained in:
@ -125,11 +125,11 @@ func (m *MSTeamsPayload) Push(p *api.PushPayload) (api.Payloader, error) {
|
||||
)
|
||||
|
||||
var titleLink string
|
||||
if len(p.Commits) == 1 {
|
||||
if p.TotalCommits == 1 {
|
||||
commitDesc = "1 new commit"
|
||||
titleLink = p.Commits[0].URL
|
||||
} else {
|
||||
commitDesc = fmt.Sprintf("%d new commits", len(p.Commits))
|
||||
commitDesc = fmt.Sprintf("%d new commits", p.TotalCommits)
|
||||
titleLink = p.CompareURL
|
||||
}
|
||||
if titleLink == "" {
|
||||
@ -156,7 +156,7 @@ func (m *MSTeamsPayload) Push(p *api.PushPayload) (api.Payloader, error) {
|
||||
text,
|
||||
titleLink,
|
||||
greenColor,
|
||||
&MSTeamsFact{"Commit count:", fmt.Sprintf("%d", len(p.Commits))},
|
||||
&MSTeamsFact{"Commit count:", fmt.Sprintf("%d", p.TotalCommits)},
|
||||
), nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user