mirror of
https://github.com/go-gitea/gitea
synced 2025-01-26 14:17:45 +01:00
Some improvements
This commit is contained in:
parent
7fd210b733
commit
30d4010983
@ -4,6 +4,8 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
git_model "code.gitea.io/gitea/models/git"
|
git_model "code.gitea.io/gitea/models/git"
|
||||||
issues_model "code.gitea.io/gitea/models/issues"
|
issues_model "code.gitea.io/gitea/models/issues"
|
||||||
access_model "code.gitea.io/gitea/models/perm/access"
|
access_model "code.gitea.io/gitea/models/perm/access"
|
||||||
@ -19,6 +21,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func CreateBranchFromIssue(ctx *context.Context) {
|
func CreateBranchFromIssue(ctx *context.Context) {
|
||||||
|
if ctx.HasError() { // form binding error check
|
||||||
|
ctx.JSONError(ctx.GetErrMsg())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
issue := GetActionIssue(ctx)
|
issue := GetActionIssue(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
@ -56,12 +63,7 @@ func CreateBranchFromIssue(ctx *context.Context) {
|
|||||||
|
|
||||||
canCreateBranch := perm.CanWrite(unit_model.TypeCode) && repo.CanCreateBranch()
|
canCreateBranch := perm.CanWrite(unit_model.TypeCode) && repo.CanCreateBranch()
|
||||||
if !canCreateBranch {
|
if !canCreateBranch {
|
||||||
ctx.NotFound("CreateBranch", nil)
|
ctx.Error(http.StatusForbidden, "No permission to create branch in this repository")
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if ctx.HasError() {
|
|
||||||
ctx.JSONError(ctx.GetErrMsg())
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user