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.
This commit is contained in:
parent
acdb92ad42
commit
11ac14cfe1
1 changed files with 4 additions and 4 deletions
|
@ -219,10 +219,6 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||||
log.Error("updateIssuesCommit: %v", err)
|
log.Error("updateIssuesCommit: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(commits.Commits) > setting.UI.FeedMaxCommitNum {
|
|
||||||
commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum]
|
|
||||||
}
|
|
||||||
|
|
||||||
oldCommitID := opts.OldCommitID
|
oldCommitID := opts.OldCommitID
|
||||||
if oldCommitID == git.EmptySHA && len(commits.Commits) > 0 {
|
if oldCommitID == git.EmptySHA && len(commits.Commits) > 0 {
|
||||||
oldCommit, err := gitRepo.GetCommit(commits.Commits[len(commits.Commits)-1].Sha1)
|
oldCommit, err := gitRepo.GetCommit(commits.Commits[len(commits.Commits)-1].Sha1)
|
||||||
|
@ -250,6 +246,10 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||||
commits.CompareURL = ""
|
commits.CompareURL = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(commits.Commits) > setting.UI.FeedMaxCommitNum {
|
||||||
|
commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum]
|
||||||
|
}
|
||||||
|
|
||||||
notification.NotifyPushCommits(pusher, repo, opts, commits)
|
notification.NotifyPushCommits(pusher, repo, opts, commits)
|
||||||
|
|
||||||
if err = git_model.RemoveDeletedBranchByName(repo.ID, branch); err != nil {
|
if err = git_model.RemoveDeletedBranchByName(repo.ID, branch); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue