mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-24 20:22:41 +01:00
keep sure if assigneeIDs == nil -> do nothing
This commit is contained in:
parent
1f90147f39
commit
e72d94129c
2 changed files with 35 additions and 30 deletions
|
@ -344,22 +344,24 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the passed assignees is assignable
|
if assigneeIDs != nil {
|
||||||
for _, aID := range assigneeIDs {
|
for _, aID := range assigneeIDs {
|
||||||
assignee, err := models.GetUserByID(aID)
|
assignee, err := models.GetUserByID(aID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(500, "GetUserByID", err)
|
ctx.Error(500, "GetUserByID", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
valid, err := models.CanBeAssigned(assignee, ctx.Repo.Repository, false)
|
// Check if the passed assignees is assignable
|
||||||
if err != nil {
|
valid, err := models.CanBeAssigned(assignee, ctx.Repo.Repository, false)
|
||||||
ctx.Error(500, "canBeAssigned", err)
|
if err != nil {
|
||||||
return
|
ctx.Error(500, "canBeAssigned", err)
|
||||||
}
|
return
|
||||||
if !valid {
|
}
|
||||||
ctx.Error(422, "canBeAssigned", models.ErrUserDoesNotHaveAccessToRepo{UserID: aID, RepoName: ctx.Repo.Repository.Name})
|
if !valid {
|
||||||
return
|
ctx.Error(422, "canBeAssigned", models.ErrUserDoesNotHaveAccessToRepo{UserID: aID, RepoName: ctx.Repo.Repository.Name})
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -286,22 +286,25 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Check if the passed assignees is assignable
|
|
||||||
for _, aID := range assigneeIDs {
|
|
||||||
assignee, err := models.GetUserByID(aID)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Error(500, "GetUserByID", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
valid, err := models.CanBeAssigned(assignee, repo, true)
|
if assigneeIDs != nil {
|
||||||
if err != nil {
|
for _, aID := range assigneeIDs {
|
||||||
ctx.Error(500, "canBeAssigned", err)
|
assignee, err := models.GetUserByID(aID)
|
||||||
return
|
if err != nil {
|
||||||
}
|
ctx.Error(500, "GetUserByID", err)
|
||||||
if !valid {
|
return
|
||||||
ctx.Error(422, "canBeAssigned", models.ErrUserDoesNotHaveAccessToRepo{UserID: aID, RepoName: repo.Name})
|
}
|
||||||
return
|
|
||||||
|
// Check if the passed assignees is assignable
|
||||||
|
valid, err := models.CanBeAssigned(assignee, repo, true)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Error(500, "canBeAssigned", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !valid {
|
||||||
|
ctx.Error(422, "canBeAssigned", models.ErrUserDoesNotHaveAccessToRepo{UserID: aID, RepoName: repo.Name})
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue