diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-10-18 15:46:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 15:46:13 +0800 |
commit | 19df07f0219e63ee0328397667a85121020b07ee (patch) | |
tree | 87c9f246266bedca7593a680d06405efaa256dd3 | |
parent | 5a84558e7cbf87594a4076d5a785c5bdc0445f95 (diff) | |
download | gitea-19df07f0219e63ee0328397667a85121020b07ee.tar.gz gitea-19df07f0219e63ee0328397667a85121020b07ee.zip |
Fix incorrect notification commit url (#21479) (#21483)
Backport #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.
-rw-r--r-- | services/repository/push.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/services/repository/push.go b/services/repository/push.go index 65ac7b660c..561f6acdd8 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -220,10 +220,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) @@ -251,6 +247,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 { |