summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/pull.go')
-rw-r--r--routers/api/v1/repo/pull.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index dda8387913..f53ab4b8f3 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -251,9 +251,15 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
deadlineUnix = util.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: repo.NextIssueIndex(),
+ Index: maxIndex + 1,
Title: form.Title,
PosterID: ctx.User.ID,
Poster: ctx.User,