diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-12 20:06:33 +0800 |
---|---|---|
committer | Thibault Meyer <0xbaadf00d@users.noreply.github.com> | 2016-11-12 13:06:33 +0100 |
commit | 3dedc027accc3f696a2cb08967177d770fe976de (patch) | |
tree | 91d01eb4705e8e2d6f6119e55cd9423fafc1ee7f /models/issue.go | |
parent | 54e6ed3431c559f4534210f8e5431acff0a99735 (diff) | |
download | gitea-3dedc027accc3f696a2cb08967177d770fe976de.tar.gz gitea-3dedc027accc3f696a2cb08967177d770fe976de.zip |
Bug fixed for issues (#156)
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/models/issue.go b/models/issue.go index 40b96da658..09ecb2e6d3 100644 --- a/models/issue.go +++ b/models/issue.go @@ -820,20 +820,12 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) { sess := x.Limit(setting.UI.IssuePagingNum, (opts.Page-1)*setting.UI.IssuePagingNum) if opts.RepoID > 0 { - sess. - Where("issue.repo_id=?", opts.RepoID). - And("issue.is_closed=?", opts.IsClosed) - } else if opts.RepoIDs != nil { + sess.And("issue.repo_id=?", opts.RepoID) + } else if len(opts.RepoIDs) > 0 { // In case repository IDs are provided but actually no repository has issue. - if len(opts.RepoIDs) == 0 { - return make([]*Issue, 0), nil - } - sess. - In("issue.repo_id", opts.RepoIDs). - And("issue.is_closed=?", opts.IsClosed) - } else { - sess.Where("issue.is_closed=?", opts.IsClosed) + sess.In("issue.repo_id", opts.RepoIDs) } + sess.And("issue.is_closed=?", opts.IsClosed) if opts.AssigneeID > 0 { sess.And("issue.assignee_id=?", opts.AssigneeID) @@ -1185,9 +1177,9 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul Where("issue.is_closed = ?", isClosed). And("issue.is_pull = ?", isPull) - if repoID > 0 || len(repoIDs) == 0 { + if repoID > 0 { sess.And("repo_id = ?", repoID) - } else { + } else if len(repoIDs) > 0 { sess.In("repo_id", repoIDs) } |