From ce249c59edaa2082b3d3900fc7edb5b433ea8c3b Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Mon, 10 Jul 2023 16:08:36 +0300 Subject: [PATCH] Hide push notifications from merged branches Fixes #25778 Co-authored-by: yp05327 <576951401@qq.com> --- models/git/branch.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/models/git/branch.go b/models/git/branch.go index d57b72719ce8..ef5e2e1b82ff 100644 --- a/models/git/branch.go +++ b/models/git/branch.go @@ -387,10 +387,13 @@ func FindRecentlyPushedNewBranches(ctx context.Context, repoID, userID int64, ex branches := make(BranchList, 0, 2) subQuery := builder.Select("head_branch").From("pull_request"). InnerJoin("issue", "issue.id = pull_request.issue_id"). - Where(builder.Eq{ - "pull_request.head_repo_id": repoID, - "issue.is_closed": false, - }) + Where(builder.And( + builder.Eq{"pull_request.head_repo_id": repoID}, + builder.Or( + builder.Eq{"issue.is_closed": false}, + builder.Eq{"pull_request.has_merged": true}, + ), + )) err := db.GetEngine(ctx). Where("pusher_id=? AND is_deleted=?", userID, false). And("name <> ?", excludeBranchName).