diff --git a/routers/web/repo/setting/protected_branch.go b/routers/web/repo/setting/protected_branch.go index 7d943fd434..e34bdcd01f 100644 --- a/routers/web/repo/setting/protected_branch.go +++ b/routers/web/repo/setting/protected_branch.go @@ -321,6 +321,16 @@ func DeleteProtectedBranchRulePost(ctx *context.Context) { ctx.JSONRedirect(fmt.Sprintf("%s/settings/branches", ctx.Repo.RepoLink)) } +func UpdateBranchProtectionPriories(ctx *context.Context) { + form := web.GetForm(ctx).([]int64) + repo := ctx.Repo.Repository + + if err := git_model.UpdateProtectBranchPriorities(ctx, repo, form); err != nil { + ctx.ServerError("UpdateProtectBranchPriorities", err) + return + } +} + // RenameBranchPost responses for rename a branch func RenameBranchPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.RenameBranchForm) diff --git a/routers/web/web.go b/routers/web/web.go index f28ec82c8f..cd26ddc328 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1075,6 +1075,7 @@ func registerRoutes(m *web.Router) { m.Combo("/edit").Get(repo_setting.SettingsProtectedBranch). Post(web.Bind(forms.ProtectBranchForm{}), context.RepoMustNotBeArchived(), repo_setting.SettingsProtectedBranchPost) m.Post("/{id}/delete", repo_setting.DeleteProtectedBranchRulePost) + m.Post("/priority", web.Bind([]int64{}), context.RepoMustNotBeArchived(), repo_setting.UpdateBranchProtectionPriories) }) m.Group("/tags", func() {