summaryrefslogtreecommitdiffstats
path: root/models/issues/issue.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issues/issue.go')
-rw-r--r--models/issues/issue.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/models/issues/issue.go b/models/issues/issue.go
index 49bc229c6b..737b625abc 100644
--- a/models/issues/issue.go
+++ b/models/issues/issue.go
@@ -1064,19 +1064,19 @@ func NewIssueWithIndex(ctx context.Context, doer *user_model.User, opts NewIssue
// NewIssue creates new issue with labels for repository.
func NewIssue(repo *repo_model.Repository, issue *Issue, labelIDs []int64, uuids []string) (err error) {
- idx, err := db.GetNextResourceIndex("issue_index", repo.ID)
- if err != nil {
- return fmt.Errorf("generate issue index failed: %v", err)
- }
-
- issue.Index = idx
-
ctx, committer, err := db.TxContext()
if err != nil {
return err
}
defer committer.Close()
+ idx, err := db.GetNextResourceIndex(ctx, "issue_index", repo.ID)
+ if err != nil {
+ return fmt.Errorf("generate issue index failed: %w", err)
+ }
+
+ issue.Index = idx
+
if err = NewIssueWithIndex(ctx, issue.Poster, NewIssueOptions{
Repo: repo,
Issue: issue,