mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-26 09:50:41 +00: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,7 +344,7 @@ 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 {
|
||||||
|
@ -352,6 +352,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the passed assignees is assignable
|
||||||
valid, err := models.CanBeAssigned(assignee, ctx.Repo.Repository, false)
|
valid, err := models.CanBeAssigned(assignee, ctx.Repo.Repository, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(500, "canBeAssigned", err)
|
ctx.Error(500, "canBeAssigned", err)
|
||||||
|
@ -362,6 +363,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// setting labels is not allowed if user is not a writer
|
// setting labels is not allowed if user is not a writer
|
||||||
form.Labels = make([]int64, 0)
|
form.Labels = make([]int64, 0)
|
||||||
|
|
|
@ -286,7 +286,8 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
|
||||||
}
|
}
|
||||||
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 {
|
||||||
|
@ -294,6 +295,7 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the passed assignees is assignable
|
||||||
valid, err := models.CanBeAssigned(assignee, repo, true)
|
valid, err := models.CanBeAssigned(assignee, repo, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(500, "canBeAssigned", err)
|
ctx.Error(500, "canBeAssigned", err)
|
||||||
|
@ -304,6 +306,7 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := pull_service.NewPullRequest(repo, prIssue, labelIDs, []string{}, pr, patch, assigneeIDs); err != nil {
|
if err := pull_service.NewPullRequest(repo, prIssue, labelIDs, []string{}, pr, patch, assigneeIDs); err != nil {
|
||||||
if models.IsErrUserDoesNotHaveAccessToRepo(err) {
|
if models.IsErrUserDoesNotHaveAccessToRepo(err) {
|
||||||
|
|
Loading…
Reference in a new issue