@@ -99,21 +99,19 @@ func applySorts(sess *xorm.Session, sortType string, priorityRepoID int64) {
99
99
}
100
100
}
101
101
102
- func applyLimit (sess * xorm.Session , opts * IssuesOptions ) * xorm. Session {
102
+ func applyLimit (sess * xorm.Session , opts * IssuesOptions ) {
103
103
if opts .Paginator == nil || opts .Paginator .IsListAll () {
104
- return sess
104
+ return
105
105
}
106
106
107
107
start := 0
108
108
if opts .Paginator .Page > 1 {
109
109
start = (opts .Paginator .Page - 1 ) * opts .Paginator .PageSize
110
110
}
111
111
sess .Limit (opts .Paginator .PageSize , start )
112
-
113
- return sess
114
112
}
115
113
116
- func applyLabelsCondition (sess * xorm.Session , opts * IssuesOptions ) * xorm. Session {
114
+ func applyLabelsCondition (sess * xorm.Session , opts * IssuesOptions ) {
117
115
if len (opts .LabelIDs ) > 0 {
118
116
if opts .LabelIDs [0 ] == 0 {
119
117
sess .Where ("issue.id NOT IN (SELECT issue_id FROM issue_label)" )
@@ -136,11 +134,9 @@ func applyLabelsCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Session
136
134
if len (opts .ExcludedLabelNames ) > 0 {
137
135
sess .And (builder .NotIn ("issue.id" , BuildLabelNamesIssueIDsCondition (opts .ExcludedLabelNames )))
138
136
}
139
-
140
- return sess
141
137
}
142
138
143
- func applyMilestoneCondition (sess * xorm.Session , opts * IssuesOptions ) * xorm. Session {
139
+ func applyMilestoneCondition (sess * xorm.Session , opts * IssuesOptions ) {
144
140
if len (opts .MilestoneIDs ) == 1 && opts .MilestoneIDs [0 ] == db .NoConditionID {
145
141
sess .And ("issue.milestone_id = 0" )
146
142
} else if len (opts .MilestoneIDs ) > 0 {
@@ -153,11 +149,9 @@ func applyMilestoneCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Sess
153
149
From ("milestone" ).
154
150
Where (builder .In ("name" , opts .IncludeMilestones )))
155
151
}
156
-
157
- return sess
158
152
}
159
153
160
- func applyProjectCondition (sess * xorm.Session , opts * IssuesOptions ) * xorm. Session {
154
+ func applyProjectCondition (sess * xorm.Session , opts * IssuesOptions ) {
161
155
if opts .ProjectID > 0 { // specific project
162
156
sess .Join ("INNER" , "project_issue" , "issue.id = project_issue.issue_id" ).
163
157
And ("project_issue.project_id=?" , opts .ProjectID )
@@ -166,21 +160,19 @@ func applyProjectCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Sessio
166
160
}
167
161
// opts.ProjectID == 0 means all projects,
168
162
// do not need to apply any condition
169
- return sess
170
163
}
171
164
172
- func applyProjectColumnCondition (sess * xorm.Session , opts * IssuesOptions ) * xorm. Session {
165
+ func applyProjectColumnCondition (sess * xorm.Session , opts * IssuesOptions ) {
173
166
// opts.ProjectColumnID == 0 means all project columns,
174
167
// do not need to apply any condition
175
168
if opts .ProjectColumnID > 0 {
176
169
sess .In ("issue.id" , builder .Select ("issue_id" ).From ("project_issue" ).Where (builder.Eq {"project_board_id" : opts .ProjectColumnID }))
177
170
} else if opts .ProjectColumnID == db .NoConditionID {
178
171
sess .In ("issue.id" , builder .Select ("issue_id" ).From ("project_issue" ).Where (builder.Eq {"project_board_id" : 0 }))
179
172
}
180
- return sess
181
173
}
182
174
183
- func applyRepoConditions (sess * xorm.Session , opts * IssuesOptions ) * xorm. Session {
175
+ func applyRepoConditions (sess * xorm.Session , opts * IssuesOptions ) {
184
176
if len (opts .RepoIDs ) == 1 {
185
177
opts .RepoCond = builder.Eq {"issue.repo_id" : opts .RepoIDs [0 ]}
186
178
} else if len (opts .RepoIDs ) > 1 {
@@ -195,10 +187,9 @@ func applyRepoConditions(sess *xorm.Session, opts *IssuesOptions) *xorm.Session
195
187
if opts .RepoCond != nil {
196
188
sess .And (opts .RepoCond )
197
189
}
198
- return sess
199
190
}
200
191
201
- func applyConditions (sess * xorm.Session , opts * IssuesOptions ) * xorm. Session {
192
+ func applyConditions (sess * xorm.Session , opts * IssuesOptions ) {
202
193
if len (opts .IssueIDs ) > 0 {
203
194
sess .In ("issue.id" , opts .IssueIDs )
204
195
}
@@ -261,8 +252,6 @@ func applyConditions(sess *xorm.Session, opts *IssuesOptions) *xorm.Session {
261
252
if opts .User != nil {
262
253
sess .And (issuePullAccessibleRepoCond ("issue.repo_id" , opts .User .ID , opts .Org , opts .Team , opts .IsPull .Value ()))
263
254
}
264
-
265
- return sess
266
255
}
267
256
268
257
// teamUnitsRepoCond returns query condition for those repo id in the special org team with special units access
@@ -339,22 +328,22 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *organizati
339
328
return cond
340
329
}
341
330
342
- func applyAssigneeCondition (sess * xorm.Session , assigneeID int64 ) * xorm. Session {
343
- return sess .Join ("INNER" , "issue_assignees" , "issue.id = issue_assignees.issue_id" ).
331
+ func applyAssigneeCondition (sess * xorm.Session , assigneeID int64 ) {
332
+ sess .Join ("INNER" , "issue_assignees" , "issue.id = issue_assignees.issue_id" ).
344
333
And ("issue_assignees.assignee_id = ?" , assigneeID )
345
334
}
346
335
347
- func applyPosterCondition (sess * xorm.Session , posterID int64 ) * xorm. Session {
348
- return sess .And ("issue.poster_id=?" , posterID )
336
+ func applyPosterCondition (sess * xorm.Session , posterID int64 ) {
337
+ sess .And ("issue.poster_id=?" , posterID )
349
338
}
350
339
351
- func applyMentionedCondition (sess * xorm.Session , mentionedID int64 ) * xorm. Session {
352
- return sess .Join ("INNER" , "issue_user" , "issue.id = issue_user.issue_id" ).
340
+ func applyMentionedCondition (sess * xorm.Session , mentionedID int64 ) {
341
+ sess .Join ("INNER" , "issue_user" , "issue.id = issue_user.issue_id" ).
353
342
And ("issue_user.is_mentioned = ?" , true ).
354
343
And ("issue_user.uid = ?" , mentionedID )
355
344
}
356
345
357
- func applyReviewRequestedCondition (sess * xorm.Session , reviewRequestedID int64 ) * xorm. Session {
346
+ func applyReviewRequestedCondition (sess * xorm.Session , reviewRequestedID int64 ) {
358
347
existInTeamQuery := builder .Select ("team_user.team_id" ).
359
348
From ("team_user" ).
360
349
Where (builder.Eq {"team_user.uid" : reviewRequestedID })
@@ -375,11 +364,11 @@ func applyReviewRequestedCondition(sess *xorm.Session, reviewRequestedID int64)
375
364
),
376
365
builder .In ("review.id" , maxReview ),
377
366
))
378
- return sess .Where ("issue.poster_id <> ?" , reviewRequestedID ).
367
+ sess .Where ("issue.poster_id <> ?" , reviewRequestedID ).
379
368
And (builder .In ("issue.id" , subQuery ))
380
369
}
381
370
382
- func applyReviewedCondition (sess * xorm.Session , reviewedID int64 ) * xorm. Session {
371
+ func applyReviewedCondition (sess * xorm.Session , reviewedID int64 ) {
383
372
// Query for pull requests where you are a reviewer or commenter, excluding
384
373
// any pull requests already returned by the review requested filter.
385
374
notPoster := builder.Neq {"issue.poster_id" : reviewedID }
@@ -406,11 +395,11 @@ func applyReviewedCondition(sess *xorm.Session, reviewedID int64) *xorm.Session
406
395
builder .In ("type" , CommentTypeComment , CommentTypeCode , CommentTypeReview ),
407
396
)),
408
397
)
409
- return sess .And (notPoster , builder .Or (reviewed , commented ))
398
+ sess .And (notPoster , builder .Or (reviewed , commented ))
410
399
}
411
400
412
- func applySubscribedCondition (sess * xorm.Session , subscriberID int64 ) * xorm. Session {
413
- return sess .And (
401
+ func applySubscribedCondition (sess * xorm.Session , subscriberID int64 ) {
402
+ sess .And (
414
403
builder .
415
404
NotIn ("issue.id" ,
416
405
builder .Select ("issue_id" ).
0 commit comments