From bc81f757b1a3c20476f8adec3903e84845827cf0 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 21 Oct 2024 19:00:16 +0200 Subject: [PATCH] add route for webui --- routers/web/repo/setting/protected_branch.go | 10 ++++++++++ routers/web/web.go | 1 + 2 files changed, 11 insertions(+) diff --git a/routers/web/repo/setting/protected_branch.go b/routers/web/repo/setting/protected_branch.go index 7d943fd434df..e34bdcd01f76 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 f28ec82c8f0b..cd26ddc3289b 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() {