@@ -820,13 +820,17 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
820820 sess := x .Limit (setting .UI .IssuePagingNum , (opts .Page - 1 )* setting .UI .IssuePagingNum )
821821
822822 if opts .RepoID > 0 {
823- sess .Where ("issue.repo_id=?" , opts .RepoID ).And ("issue.is_closed=?" , opts .IsClosed )
823+ sess .
824+ Where ("issue.repo_id=?" , opts .RepoID ).
825+ And ("issue.is_closed=?" , opts .IsClosed )
824826 } else if opts .RepoIDs != nil {
825827 // In case repository IDs are provided but actually no repository has issue.
826828 if len (opts .RepoIDs ) == 0 {
827829 return make ([]* Issue , 0 ), nil
828830 }
829- sess .In ("issue.repo_id" , base .Int64sToStrings (opts .RepoIDs )).And ("issue.is_closed=?" , opts .IsClosed )
831+ sess .
832+ In ("issue.repo_id" , base .Int64sToStrings (opts .RepoIDs )).
833+ And ("issue.is_closed=?" , opts .IsClosed )
830834 } else {
831835 sess .Where ("issue.is_closed=?" , opts .IsClosed )
832836 }
@@ -863,12 +867,16 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
863867 if len (opts .Labels ) > 0 && opts .Labels != "0" {
864868 labelIDs := base .StringsToInt64s (strings .Split (opts .Labels , "," ))
865869 if len (labelIDs ) > 0 {
866- sess .Join ("INNER" , "issue_label" , "issue.id = issue_label.issue_id" ).In ("issue_label.label_id" , labelIDs )
870+ sess .
871+ Join ("INNER" , "issue_label" , "issue.id = issue_label.issue_id" ).
872+ In ("issue_label.label_id" , labelIDs )
867873 }
868874 }
869875
870876 if opts .IsMention {
871- sess .Join ("INNER" , "issue_user" , "issue.id = issue_user.issue_id" ).And ("issue_user.is_mentioned = ?" , true )
877+ sess .
878+ Join ("INNER" , "issue_user" , "issue.id = issue_user.issue_id" ).
879+ And ("issue_user.is_mentioned = ?" , true )
872880
873881 if opts .UserID > 0 {
874882 sess .And ("issue_user.uid = ?" , opts .UserID )
@@ -991,15 +999,21 @@ func GetIssueUserPairsByRepoIds(rids []int64, isClosed bool, page int) ([]*Issue
991999 }
9921000
9931001 ius := make ([]* IssueUser , 0 , 10 )
994- sess := x .Limit (20 , (page - 1 )* 20 ).Where ("is_closed=?" , isClosed ).In ("repo_id" , rids )
1002+ sess := x .
1003+ Limit (20 , (page - 1 )* 20 ).
1004+ Where ("is_closed=?" , isClosed ).
1005+ In ("repo_id" , rids )
9951006 err := sess .Find (& ius )
9961007 return ius , err
9971008}
9981009
9991010// GetIssueUserPairsByMode returns issue-user pairs by given repository and user.
10001011func GetIssueUserPairsByMode (uid , rid int64 , isClosed bool , page , filterMode int ) ([]* IssueUser , error ) {
10011012 ius := make ([]* IssueUser , 0 , 10 )
1002- sess := x .Limit (20 , (page - 1 )* 20 ).Where ("uid=?" , uid ).And ("is_closed=?" , isClosed )
1013+ sess := x .
1014+ Limit (20 , (page - 1 )* 20 ).
1015+ Where ("uid=?" , uid ).
1016+ And ("is_closed=?" , isClosed )
10031017 if rid > 0 {
10041018 sess .And ("repo_id=?" , rid )
10051019 }
@@ -1101,12 +1115,16 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
11011115 stats := & IssueStats {}
11021116
11031117 countSession := func (opts * IssueStatsOptions ) * xorm.Session {
1104- sess := x .Where ("issue.repo_id = ?" , opts .RepoID ).And ("is_pull = ?" , opts .IsPull )
1118+ sess := x .
1119+ Where ("issue.repo_id = ?" , opts .RepoID ).
1120+ And ("is_pull = ?" , opts .IsPull )
11051121
11061122 if len (opts .Labels ) > 0 && opts .Labels != "0" {
11071123 labelIDs := base .StringsToInt64s (strings .Split (opts .Labels , "," ))
11081124 if len (labelIDs ) > 0 {
1109- sess .Join ("INNER" , "issue_label" , "issue.id = issue_id" ).In ("label_id" , labelIDs )
1125+ sess .
1126+ Join ("INNER" , "issue_label" , "issue.id = issue_id" ).
1127+ In ("label_id" , labelIDs )
11101128 }
11111129 }
11121130
@@ -1163,7 +1181,9 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
11631181 stats := & IssueStats {}
11641182
11651183 countSession := func (isClosed , isPull bool , repoID int64 , repoIDs []int64 ) * xorm.Session {
1166- sess := x .Where ("issue.is_closed = ?" , isClosed ).And ("issue.is_pull = ?" , isPull )
1184+ sess := x .
1185+ Where ("issue.is_closed = ?" , isClosed ).
1186+ And ("issue.is_pull = ?" , isPull )
11671187
11681188 if repoID > 0 || len (repoIDs ) == 0 {
11691189 sess .And ("repo_id = ?" , repoID )
@@ -1203,7 +1223,8 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
12031223// GetRepoIssueStats returns number of open and closed repository issues by given filter mode.
12041224func GetRepoIssueStats (repoID , uid int64 , filterMode int , isPull bool ) (numOpen int64 , numClosed int64 ) {
12051225 countSession := func (isClosed , isPull bool , repoID int64 ) * xorm.Session {
1206- sess := x .Where ("issue.repo_id = ?" , isClosed ).
1226+ sess := x .
1227+ Where ("issue.repo_id = ?" , isClosed ).
12071228 And ("is_pull = ?" , isPull ).
12081229 And ("repo_id = ?" , repoID )
12091230
@@ -1463,7 +1484,9 @@ func UpdateMilestone(m *Milestone) error {
14631484}
14641485
14651486func countRepoMilestones (e Engine , repoID int64 ) int64 {
1466- count , _ := e .Where ("repo_id=?" , repoID ).Count (new (Milestone ))
1487+ count , _ := e .
1488+ Where ("repo_id=?" , repoID ).
1489+ Count (new (Milestone ))
14671490 return count
14681491}
14691492
@@ -1473,7 +1496,9 @@ func CountRepoMilestones(repoID int64) int64 {
14731496}
14741497
14751498func countRepoClosedMilestones (e Engine , repoID int64 ) int64 {
1476- closed , _ := e .Where ("repo_id=? AND is_closed=?" , repoID , true ).Count (new (Milestone ))
1499+ closed , _ := e .
1500+ Where ("repo_id=? AND is_closed=?" , repoID , true ).
1501+ Count (new (Milestone ))
14771502 return closed
14781503}
14791504
@@ -1484,7 +1509,9 @@ func CountRepoClosedMilestones(repoID int64) int64 {
14841509
14851510// MilestoneStats returns number of open and closed milestones of given repository.
14861511func MilestoneStats (repoID int64 ) (open int64 , closed int64 ) {
1487- open , _ = x .Where ("repo_id=? AND is_closed=?" , repoID , false ).Count (new (Milestone ))
1512+ open , _ = x .
1513+ Where ("repo_id=? AND is_closed=?" , repoID , false ).
1514+ Count (new (Milestone ))
14881515 return open , CountRepoClosedMilestones (repoID )
14891516}
14901517
0 commit comments