@@ -1165,7 +1165,8 @@ func GetIssuesByIDs(issueIDs []int64) ([]*Issue, error) {
1165
1165
// IssuesOptions represents options of an issue.
1166
1166
type IssuesOptions struct {
1167
1167
db.ListOptions
1168
- RepoIDs []int64 // include all repos if empty
1168
+ RepoID int64 // overwrites RepoCond if not 0
1169
+ RepoCond builder.Cond
1169
1170
AssigneeID int64
1170
1171
PosterID int64
1171
1172
MentionedID int64
@@ -1256,15 +1257,15 @@ func (opts *IssuesOptions) setupSessionNoLimit(sess *xorm.Session) {
1256
1257
sess .In ("issue.id" , opts .IssueIDs )
1257
1258
}
1258
1259
1259
- if len (opts .RepoIDs ) > 0 {
1260
- applyReposCondition (sess , opts .RepoIDs )
1260
+ if opts .RepoID != 0 {
1261
+ opts .RepoCond = builder.Eq {"issue.repo_id" : opts .RepoID }
1262
+ }
1263
+ if opts .RepoCond != nil {
1264
+ sess .And (opts .RepoCond )
1261
1265
}
1262
1266
1263
- switch opts .IsClosed {
1264
- case util .OptionalBoolTrue :
1265
- sess .And ("issue.is_closed=?" , true )
1266
- case util .OptionalBoolFalse :
1267
- sess .And ("issue.is_closed=?" , false )
1267
+ if ! opts .IsClosed .IsNone () {
1268
+ sess .And ("issue.is_closed=?" , opts .IsClosed .IsTrue ())
1268
1269
}
1269
1270
1270
1271
if opts .AssigneeID > 0 {
@@ -1383,10 +1384,6 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *Organizati
1383
1384
return cond
1384
1385
}
1385
1386
1386
- func applyReposCondition (sess * xorm.Session , repoIDs []int64 ) * xorm.Session {
1387
- return sess .In ("issue.repo_id" , repoIDs )
1388
- }
1389
-
1390
1387
func applyAssigneeCondition (sess * xorm.Session , assigneeID int64 ) * xorm.Session {
1391
1388
return sess .Join ("INNER" , "issue_assignees" , "issue.id = issue_assignees.issue_id" ).
1392
1389
And ("issue_assignees.assignee_id = ?" , assigneeID )
0 commit comments