1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00

Make branch deletion URL more like GitHub's, fixes #1397 (#1994)

* Make branch deletion URL more like GitHub's, fixes #1397

* Add PR branch deletion integration test

* Do not allow deleting protected branch

* Change http error code to 403 if user has no write rights to repository

* Add check to not panic if forked repository has alrady been deleted
This commit is contained in:
Lauris BH
2017-06-21 04:00:03 +03:00
committed by Lunny Xiao
parent 6db387a21e
commit 0a5dc640a1
7 changed files with 241 additions and 70 deletions

View File

@@ -562,9 +562,6 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/milestones", repo.Milestones)
}, context.RepoRef())
// m.Get("/branches", repo.Branches)
m.Post("/branches/:name/delete", reqSignIn, reqRepoWriter, repo.MustBeNotBare, repo.DeleteBranchPost)
m.Group("/wiki", func() {
m.Get("/?:page", repo.Wiki)
m.Get("/_pages", repo.WikiPages)
@@ -589,6 +586,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/commits", context.RepoRef(), repo.ViewPullCommits)
m.Get("/files", context.RepoRef(), repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.ViewPullFiles)
m.Post("/merge", reqRepoWriter, repo.MergePullRequest)
m.Post("/cleanup", context.RepoRef(), repo.CleanUpPullRequest)
}, repo.MustAllowPulls, context.CheckUnit(models.UnitTypePullRequests))
m.Group("", func() {