mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-26 06:33:42 +09:00
enhance: allow auto-closing PRs from PRs (#39393)
On GitHub, one can close PRs via `Fixes: #123` references which was not possible on Gitea before, but now is. Verified fully that behaviour matches GH and ensured no regressions for external trackers.
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
issues_model "gitea.dev/models/issues"
|
||||
access_model "gitea.dev/models/perm/access"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
"gitea.dev/models/unit"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/container"
|
||||
"gitea.dev/modules/git"
|
||||
@@ -188,8 +189,8 @@ func UpdateIssuesCommit(ctx context.Context, doer *user_model.User, repo *repo_m
|
||||
return err
|
||||
}
|
||||
|
||||
// Only issues can be closed/reopened this way, and user needs the correct permissions
|
||||
if refIssue.IsPull || !canclose {
|
||||
// Only issues can be reopened this way, and user needs the correct permissions
|
||||
if !canclose || (refIssue.IsPull && ref.Action == references.XRefActionReopens) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -198,6 +199,11 @@ func UpdateIssuesCommit(ctx context.Context, doer *user_model.User, repo *repo_m
|
||||
continue
|
||||
}
|
||||
|
||||
// With an external tracker, pull requests are referenced as "!N"
|
||||
if !ref.IsPull && refIssue.IsPull && refRepo.UnitEnabled(ctx, unit.TypeExternalTracker) {
|
||||
continue
|
||||
}
|
||||
|
||||
if !repo.CloseIssuesViaCommitInAnyBranch {
|
||||
// If the issue was specified to be in a particular branch, don't allow commits in other branches to close it
|
||||
if refIssue.Ref != "" {
|
||||
|
||||
Reference in New Issue
Block a user