mirror of
https://github.com/go-gitea/gitea
synced 2025-08-26 11:28:27 +00:00
* Fix bug on branch API (#10767) * Fix branch api canPush and canMerge
This commit is contained in:
@@ -70,7 +70,13 @@ func GetBranch(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, convert.ToBranch(ctx.Repo.Repository, branch, c, branchProtection, ctx.User))
|
||||
br, err := convert.ToBranch(ctx.Repo.Repository, branch, c, branchProtection, ctx.User)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "convert.ToBranch", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, br)
|
||||
}
|
||||
|
||||
// ListBranches list all the branches of a repository
|
||||
@@ -113,7 +119,14 @@ func ListBranches(ctx *context.APIContext) {
|
||||
ctx.Error(http.StatusInternalServerError, "GetBranchProtection", err)
|
||||
return
|
||||
}
|
||||
apiBranches[i] = convert.ToBranch(ctx.Repo.Repository, branches[i], c, branchProtection, ctx.User)
|
||||
|
||||
br, err := convert.ToBranch(ctx.Repo.Repository, branches[i], c, branchProtection, ctx.User)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "convert.ToBranch", err)
|
||||
return
|
||||
}
|
||||
|
||||
apiBranches[i] = br
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, &apiBranches)
|
||||
|
Reference in New Issue
Block a user