1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

Add missing database transaction for new issue (#29490)

When creating an issue, inserting issue, assign users and set project
should be in the same transaction.
This commit is contained in:
Lunny Xiao
2024-03-04 19:24:02 +08:00
committed by GitHub
parent 7ec4c65ea5
commit e91733468e
3 changed files with 26 additions and 21 deletions

View File

@ -709,7 +709,7 @@ func CreateIssue(ctx *context.APIContext) {
form.Labels = make([]int64, 0)
}
if err := issue_service.NewIssue(ctx, ctx.Repo.Repository, issue, form.Labels, nil, assigneeIDs); err != nil {
if err := issue_service.NewIssue(ctx, ctx.Repo.Repository, issue, form.Labels, nil, assigneeIDs, 0); err != nil {
if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err)
} else if errors.Is(err, user_model.ErrBlockedUser) {