@@ -1194,7 +1194,9 @@ func GetIssuesByIDs(issueIDs []int64) ([]*Issue, error) {
1194
1194
// IssuesOptions represents options of an issue.
1195
1195
type IssuesOptions struct {
1196
1196
db.ListOptions
1197
- RepoIDs []int64 // include all repos if empty
1197
+ RepoIDs []int64 // include all repos if empty // TODO: migrate to RepoCond
1198
+ RepoID int64 // overwrites RepoCond if not 0
1199
+ RepoCond builder.Cond
1198
1200
AssigneeID int64
1199
1201
PosterID int64
1200
1202
MentionedID int64
@@ -1285,8 +1287,14 @@ func (opts *IssuesOptions) setupSessionNoLimit(sess *xorm.Session) {
1285
1287
sess .In ("issue.id" , opts .IssueIDs )
1286
1288
}
1287
1289
1288
- if len (opts .RepoIDs ) > 0 {
1289
- applyReposCondition (sess , opts .RepoIDs )
1290
+ if opts .RepoCond == nil && len (opts .RepoIDs ) != 0 {
1291
+ opts .RepoCond = builder .In ("issue.repo_id" , opts .RepoIDs )
1292
+ }
1293
+ if opts .RepoID != 0 {
1294
+ opts .RepoCond = builder.Eq {"issue.repo_id" : opts .RepoID }
1295
+ }
1296
+ if opts .RepoCond != nil {
1297
+ sess .And (opts .RepoCond )
1290
1298
}
1291
1299
1292
1300
switch opts .IsClosed {
@@ -1412,10 +1420,6 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *organizati
1412
1420
return cond
1413
1421
}
1414
1422
1415
- func applyReposCondition (sess * xorm.Session , repoIDs []int64 ) * xorm.Session {
1416
- return sess .In ("issue.repo_id" , repoIDs )
1417
- }
1418
-
1419
1423
func applyAssigneeCondition (sess * xorm.Session , assigneeID int64 ) * xorm.Session {
1420
1424
return sess .Join ("INNER" , "issue_assignees" , "issue.id = issue_assignees.issue_id" ).
1421
1425
And ("issue_assignees.assignee_id = ?" , assigneeID )
0 commit comments