From 29e46024b1cb4a6d40a94e03017a90f68ef6c77c Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 17 Oct 2022 00:55:11 +0800 Subject: [PATCH] fix notification commit url --- services/repository/push.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/repository/push.go b/services/repository/push.go index f3f505aa002d6..d645928c43bdc 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 {