Merge pull request #2130 from gitbucket/fix-slick-stackoverflow
Fix StackOverflow by deep nested condition in Slick query
commit 067a4856f446db202740de967a727b006d1d1492
2 parents b532218 + a22afc2
@Naoki Takezoe Naoki Takezoe authored on 11 Aug 2018
GitHub committed on 11 Aug 2018
Showing 1 changed file
View
10
src/main/scala/gitbucket/core/service/IssuesService.scala
private def searchIssueQuery(repos: Seq[(String, String)], condition: IssueSearchCondition, pullRequest: Boolean)(
implicit s: Session
) =
Issues filter { t1 =>
repos
.map { case (owner, repository) => t1.byRepository(owner, repository) }
.foldLeft[Rep[Boolean]](false)(_ || _) &&
(if (repos.size == 1) {
t1.byRepository(repos.head._1, repos.head._2)
} else {
((t1.userName ++ "/" ++ t1.repositoryName) inSetBind (repos.map { case (owner, repo) => s"$owner/$repo" }))
}) &&
(t1.closed === (condition.state == "closed").bind) &&
(t1.milestoneId.? isEmpty, condition.milestone == Some(None)) &&
(t1.priorityId.? isEmpty, condition.priority == Some(None)) &&
(t1.assignedUserName.? isEmpty, condition.assigned == Some(None)) &&