aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-08-26 23:17:23 -0300
committertechknowlogick <techknowlogick@gitea.io>2019-08-26 22:17:23 -0400
commit5fe2ec264febd6a4112c5f8c72c170f016bdf0c8 (patch)
treebc1261858b8278189d7b30c51faaa9b442245d0d /routers
parent541fab196f216771a51419a8b8d353694afa6c45 (diff)
downloadgitea-5fe2ec264febd6a4112c5f8c72c170f016bdf0c8.tar.gz
gitea-5fe2ec264febd6a4112c5f8c72c170f016bdf0c8.zip
Retry create issue to cope with duplicate keys (#7898)
* Retry create issue to cope with duplicate keys * Use .SetExpr().Where().Insert()
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/pull.go7
-rw-r--r--routers/repo/pull.go7
2 files changed, 0 insertions, 14 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 8168c6b010..5ac542ec20 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -252,15 +252,8 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix())
}
- maxIndex, err := models.GetMaxIndexOfIssue(repo.ID)
- if err != nil {
- ctx.ServerError("GetPatch", err)
- return
- }
-
prIssue := &models.Issue{
RepoID: repo.ID,
- Index: maxIndex + 1,
Title: form.Title,
PosterID: ctx.User.ID,
Poster: ctx.User,
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 01a57f04e4..22ccc7769c 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -710,15 +710,8 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
return
}
- maxIndex, err := models.GetMaxIndexOfIssue(repo.ID)
- if err != nil {
- ctx.ServerError("GetPatch", err)
- return
- }
-
pullIssue := &models.Issue{
RepoID: repo.ID,
- Index: maxIndex + 1,
Title: form.Title,
PosterID: ctx.User.ID,
Poster: ctx.User,