summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-05 20:45:23 -0500
committerUnknwon <u@gogs.io>2016-03-05 20:45:23 -0500
commita5b0400be7c8868b685403e0718bdd66149c3e84 (patch)
tree6db3f4999fa43e0b8a384ca4da8885aa00a4de8f /models/issue.go
parent045f14fbd0e3553521f5092cf839be363c74a090 (diff)
downloadgitea-a5b0400be7c8868b685403e0718bdd66149c3e84.tar.gz
gitea-a5b0400be7c8868b685403e0718bdd66149c3e84.zip
#1146 finish new access rights for collaborators
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/models/issue.go b/models/issue.go
index 0cda7150a1..7f1889b361 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -298,16 +298,18 @@ func newIssue(e *xorm.Session, repo *Repository, issue *Issue, labelIDs []int64,
return err
}
- // 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)
- }
+ if len(labelIDs) > 0 {
+ // 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)
+ }
- for _, label := range labels {
- if err = issue.addLabel(e, label); err != nil {
- return fmt.Errorf("addLabel: %v", err)
+ for _, label := range labels {
+ if err = issue.addLabel(e, label); err != nil {
+ return fmt.Errorf("addLabel: %v", err)
+ }
}
}