Skip to content

Commit

Permalink
Some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Oct 10, 2024
1 parent 7fd210b commit 30d4010
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions routers/web/repo/issue_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package repo

import (
"net/http"

git_model "code.gitea.io/gitea/models/git"
issues_model "code.gitea.io/gitea/models/issues"
access_model "code.gitea.io/gitea/models/perm/access"
Expand All @@ -19,6 +21,11 @@ import (
)

func CreateBranchFromIssue(ctx *context.Context) {
if ctx.HasError() { // form binding error check
ctx.JSONError(ctx.GetErrMsg())
return
}

issue := GetActionIssue(ctx)
if ctx.Written() {
return
Expand Down Expand Up @@ -56,12 +63,7 @@ func CreateBranchFromIssue(ctx *context.Context) {

canCreateBranch := perm.CanWrite(unit_model.TypeCode) && repo.CanCreateBranch()
if !canCreateBranch {
ctx.NotFound("CreateBranch", nil)
return
}

if ctx.HasError() {
ctx.JSONError(ctx.GetErrMsg())
ctx.Error(http.StatusForbidden, "No permission to create branch in this repository")
return
}

Expand Down

0 comments on commit 30d4010

Please sign in to comment.