aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issues/pull.go')
-rw-r--r--models/issues/pull.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/models/issues/pull.go b/models/issues/pull.go
index f96b03445e..69259c269f 100644
--- a/models/issues/pull.go
+++ b/models/issues/pull.go
@@ -490,13 +490,6 @@ func (pr *PullRequest) SetMerged(ctx context.Context) (bool, error) {
// NewPullRequest creates new pull request with labels for repository.
func NewPullRequest(outerCtx context.Context, repo *repo_model.Repository, issue *Issue, labelIDs []int64, uuids []string, pr *PullRequest) (err error) {
- idx, err := db.GetNextResourceIndex("issue_index", repo.ID)
- if err != nil {
- return fmt.Errorf("generate pull request index failed: %v", err)
- }
-
- issue.Index = idx
-
ctx, committer, err := db.TxContext()
if err != nil {
return err
@@ -504,6 +497,13 @@ func NewPullRequest(outerCtx context.Context, repo *repo_model.Repository, issue
defer committer.Close()
ctx.WithContext(outerCtx)
+ idx, err := db.GetNextResourceIndex(ctx, "issue_index", repo.ID)
+ if err != nil {
+ return fmt.Errorf("generate pull request index failed: %v", err)
+ }
+
+ issue.Index = idx
+
if err = NewIssueWithIndex(ctx, issue.Poster, NewIssueOptions{
Repo: repo,
Issue: issue,