Merge pull request '[gitea] week 2024-36 cherry pick (gitea/main -> forgejo)' (#5195) from earl-warren/wcp/2024-36 into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5195
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Earl Warren 2024-09-03 13:40:14 +00:00
commit 6d2fa323e0
3 changed files with 14 additions and 2 deletions

2
release-notes/5195.md Normal file
View file

@ -0,0 +1,2 @@
fix: [commit](https://codeberg.org/forgejo/forgejo/commit/196907e359420f63003f884d1cf827b4a4d7a4e5) Handle "close" actionable references for manual merges.
fix: [commit](https://codeberg.org/forgejo/forgejo/commit/46b1f2e7e4e795331f28f74666094c9416499e03) Team admins are allowed to search team members via the API.

View file

@ -855,10 +855,15 @@ func registerRoutes(m *web.Route) {
m.Post("/teams/{team}/action/repo/{action}", org.TeamsRepoAction)
}, context.OrgAssignment(true, false, true))
// require admin permission
m.Group("/{org}", func() {
m.Get("/teams/-/search", org.SearchTeam)
}, context.OrgAssignment(true, false, false, true))
// require owner permission
m.Group("/{org}", func() {
m.Get("/teams/new", org.NewTeam)
m.Post("/teams/new", web.Bind(forms.CreateTeamForm{}), org.NewTeamPost)
m.Get("/teams/-/search", org.SearchTeam)
m.Get("/teams/{team}/edit", org.EditTeam)
m.Post("/teams/{team}/edit", web.Bind(forms.CreateTeamForm{}), org.EditTeamPost)
m.Post("/teams/{team}/delete", org.DeleteTeam)

View file

@ -229,6 +229,10 @@ func Merge(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.U
// Reset cached commit count
cache.Remove(pr.Issue.Repo.GetCommitsCountCacheKey(pr.BaseBranch, true))
return handleCloseCrossReferences(ctx, pr, doer)
}
func handleCloseCrossReferences(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.User) error {
// Resolve cross references
refs, err := pr.ResolveCrossReferences(ctx)
if err != nil {
@ -553,5 +557,6 @@ func MergedManually(ctx context.Context, pr *issues_model.PullRequest, doer *use
notify_service.MergePullRequest(baseGitRepo.Ctx, doer, pr)
log.Info("manuallyMerged[%d]: Marked as manually merged into %s/%s by commit id: %s", pr.ID, pr.BaseRepo.Name, pr.BaseBranch, commitID)
return nil
return handleCloseCrossReferences(ctx, pr, doer)
}