summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-10-17 12:58:20 +0800
committerGitHub <noreply@github.com>2022-10-17 12:58:20 +0800
commit11ac14cfe12703c56d0c118102ffc207013d4156 (patch)
treece1a6642edf4a6a91e11c7ab36e578ecf443ec67 /services
parentacdb92ad425b1f7035b677f430516ab4a9f645c2 (diff)
downloadgitea-11ac14cfe12703c56d0c118102ffc207013d4156.tar.gz
gitea-11ac14cfe12703c56d0c118102ffc207013d4156.zip
Fix incorrect notification commit url (#21479)
For normal commits the notification url was wrong because oldCommitID is received from the shrinked commits list. This PR moves the commits list shrinking after the oldCommitID assignment.
Diffstat (limited to 'services')
-rw-r--r--services/repository/push.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/services/repository/push.go b/services/repository/push.go
index f3f505aa00..d645928c43 100644
--- a/services/repository/push.go
+++ b/services/repository/push.go
@@ -219,10 +219,6 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
log.Error("updateIssuesCommit: %v", err)
}
- if len(commits.Commits) > setting.UI.FeedMaxCommitNum {
- commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum]
- }
-
oldCommitID := opts.OldCommitID
if oldCommitID == git.EmptySHA && len(commits.Commits) > 0 {
oldCommit, err := gitRepo.GetCommit(commits.Commits[len(commits.Commits)-1].Sha1)
@@ -250,6 +246,10 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
commits.CompareURL = ""
}
+ if len(commits.Commits) > setting.UI.FeedMaxCommitNum {
+ commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum]
+ }
+
notification.NotifyPushCommits(pusher, repo, opts, commits)
if err = git_model.RemoveDeletedBranchByName(repo.ID, branch); err != nil {