@@ -1194,7 +1194,8 @@ func GetIssuesByIDs(issueIDs []int64) ([]*Issue, error) {
11941194// IssuesOptions represents options of an issue.
11951195type IssuesOptions struct {
11961196 db.ListOptions
1197- RepoIDs []int64 // include all repos if empty
1197+ RepoID int64 // overwrites RepoCond if not 0
1198+ RepoCond builder.Cond
11981199 AssigneeID int64
11991200 PosterID int64
12001201 MentionedID int64
@@ -1285,15 +1286,15 @@ func (opts *IssuesOptions) setupSessionNoLimit(sess *xorm.Session) {
12851286 sess .In ("issue.id" , opts .IssueIDs )
12861287 }
12871288
1288- if len (opts .RepoIDs ) > 0 {
1289- applyReposCondition (sess , opts .RepoIDs )
1289+ if opts .RepoID != 0 {
1290+ opts .RepoCond = builder.Eq {"issue.repo_id" : opts .RepoID }
1291+ }
1292+ if opts .RepoCond != nil {
1293+ sess .And (opts .RepoCond )
12901294 }
12911295
1292- switch opts .IsClosed {
1293- case util .OptionalBoolTrue :
1294- sess .And ("issue.is_closed=?" , true )
1295- case util .OptionalBoolFalse :
1296- sess .And ("issue.is_closed=?" , false )
1296+ if ! opts .IsClosed .IsNone () {
1297+ sess .And ("issue.is_closed=?" , opts .IsClosed .IsTrue ())
12971298 }
12981299
12991300 if opts .AssigneeID > 0 {
@@ -1412,10 +1413,6 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *organizati
14121413 return cond
14131414}
14141415
1415- func applyReposCondition (sess * xorm.Session , repoIDs []int64 ) * xorm.Session {
1416- return sess .In ("issue.repo_id" , repoIDs )
1417- }
1418-
14191416func applyAssigneeCondition (sess * xorm.Session , assigneeID int64 ) * xorm.Session {
14201417 return sess .Join ("INNER" , "issue_assignees" , "issue.id = issue_assignees.issue_id" ).
14211418 And ("issue_assignees.assignee_id = ?" , assigneeID )
0 commit comments