mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-01 15:55:15 +08:00
#2700 fix sqlite3 can't create issue with more than one label
This commit is contained in:
@ -297,20 +297,17 @@ func newIssue(e *xorm.Session, repo *Repository, issue *Issue, labelIDs []int64,
|
||||
return err
|
||||
}
|
||||
|
||||
var label *Label
|
||||
for _, id := range labelIDs {
|
||||
if id == 0 {
|
||||
continue
|
||||
}
|
||||
// During the session, SQLite3 dirver cannot handle retrieve objects after update something.
|
||||
// So we have to get all needed labels first.
|
||||
labels := make([]*Label, 0, len(labelIDs))
|
||||
if err = e.In("id", labelIDs).Find(&labels); err != nil {
|
||||
return fmt.Errorf("Find all labels: %v", err)
|
||||
}
|
||||
|
||||
label, err = getLabelByID(e, id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, label := range labels {
|
||||
if err = issue.addLabel(e, label); err != nil {
|
||||
return fmt.Errorf("addLabel: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if issue.MilestoneID > 0 {
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
"github.com/mcuadros/go-version"
|
||||
"gopkg.in/ini.v1"
|
||||
|
||||
"github.com/gogits/git-module"
|
||||
git "github.com/gogits/git-module"
|
||||
api "github.com/gogits/go-gogs-client"
|
||||
|
||||
"github.com/gogits/gogs/modules/bindata"
|
||||
|
Reference in New Issue
Block a user