Skip to content

Commit c1bda05

Browse files
committed
just struct
1 parent f229044 commit c1bda05

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

modules/structs/repo_branch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ type EditBranchProtectionOption struct {
130130
}
131131

132132
// UpdateBranchProtectionPriories a list to update the branch protection rule priorities
133-
type UpdateBranchProtectionPriories []struct {
134-
ID int64 `json:"id"`
133+
type UpdateBranchProtectionPriories struct {
134+
IDs []int64 `json:"ids"`
135135
}

routers/api/v1/repo/branch.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,12 +1121,7 @@ func UpdateBranchProtectionPriories(ctx *context.APIContext) {
11211121
form := web.GetForm(ctx).(*api.UpdateBranchProtectionPriories)
11221122
repo := ctx.Repo.Repository
11231123

1124-
ids := make([]int64, len(*form))
1125-
for i, v := range *form {
1126-
ids[i] = v.ID
1127-
}
1128-
1129-
if err := git_model.UpdateProtectBranchPriorities(ctx, repo, ids); err != nil {
1124+
if err := git_model.UpdateProtectBranchPriorities(ctx, repo, form.IDs); err != nil {
11301125
ctx.Error(http.StatusInternalServerError, "UpdateProtectBranchPriorities", err)
11311126
return
11321127
}

templates/swagger/v1_json.tmpl

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)