@@ -820,20 +820,12 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
820
820
sess := x .Limit (setting .UI .IssuePagingNum , (opts .Page - 1 )* setting .UI .IssuePagingNum )
821
821
822
822
if opts .RepoID > 0 {
823
- sess .
824
- Where ("issue.repo_id=?" , opts .RepoID ).
825
- And ("issue.is_closed=?" , opts .IsClosed )
826
- } else if opts .RepoIDs != nil {
823
+ sess .And ("issue.repo_id=?" , opts .RepoID )
824
+ } else if len (opts .RepoIDs ) > 0 {
827
825
// In case repository IDs are provided but actually no repository has issue.
828
- if len (opts .RepoIDs ) == 0 {
829
- return make ([]* Issue , 0 ), nil
830
- }
831
- sess .
832
- In ("issue.repo_id" , opts .RepoIDs ).
833
- And ("issue.is_closed=?" , opts .IsClosed )
834
- } else {
835
- sess .Where ("issue.is_closed=?" , opts .IsClosed )
826
+ sess .In ("issue.repo_id" , opts .RepoIDs )
836
827
}
828
+ sess .And ("issue.is_closed=?" , opts .IsClosed )
837
829
838
830
if opts .AssigneeID > 0 {
839
831
sess .And ("issue.assignee_id=?" , opts .AssigneeID )
@@ -1185,9 +1177,9 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
1185
1177
Where ("issue.is_closed = ?" , isClosed ).
1186
1178
And ("issue.is_pull = ?" , isPull )
1187
1179
1188
- if repoID > 0 || len ( repoIDs ) == 0 {
1180
+ if repoID > 0 {
1189
1181
sess .And ("repo_id = ?" , repoID )
1190
- } else {
1182
+ } else if len ( repoIDs ) > 0 {
1191
1183
sess .In ("repo_id" , repoIDs )
1192
1184
}
1193
1185
0 commit comments