diff --git a/src/main/scala/gitbucket/core/controller/PrioritiesController.scala b/src/main/scala/gitbucket/core/controller/PrioritiesController.scala index f34ed63..6231863 100644 --- a/src/main/scala/gitbucket/core/controller/PrioritiesController.scala +++ b/src/main/scala/gitbucket/core/controller/PrioritiesController.scala @@ -45,7 +45,7 @@ get("/:owner/:repository/issues/priorities")(referrersOnly { repository => html.list( getPriorities(repository.owner, repository.name), - countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty), + countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition()), repository, hasDeveloperRole(repository.owner, repository.name, context.loginAccount) ) @@ -60,7 +60,7 @@ createPriority(repository.owner, repository.name, form.priorityName, form.description, form.color.substring(1)) html.priority( getPriority(repository.owner, repository.name, priorityId).get, - countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty), + countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition()), repository, hasDeveloperRole(repository.owner, repository.name, context.loginAccount) ) @@ -84,7 +84,7 @@ ) html.priority( getPriority(repository.owner, repository.name, params("priorityId").toInt).get, - countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition(), Map.empty), + countIssueGroupByPriorities(repository.owner, repository.name, IssuesService.IssueSearchCondition()), repository, hasDeveloperRole(repository.owner, repository.name, context.loginAccount) ) diff --git a/src/main/scala/gitbucket/core/service/IssuesService.scala b/src/main/scala/gitbucket/core/service/IssuesService.scala index cbe2802..f851b88 100644 --- a/src/main/scala/gitbucket/core/service/IssuesService.scala +++ b/src/main/scala/gitbucket/core/service/IssuesService.scala @@ -147,7 +147,7 @@ t3.labelName } .map { - case labelName ~ t => + case (labelName, t) => labelName -> t.length } .list @@ -165,8 +165,7 @@ def countIssueGroupByPriorities( owner: String, repository: String, - condition: IssueSearchCondition, - filterUser: Map[String, String] + condition: IssueSearchCondition )(implicit s: Session): Map[String, Int] = { searchIssueQuery(Seq(owner -> repository), condition.copy(labels = Set.empty), IssueSearchOption.Issues) @@ -180,7 +179,7 @@ t2.priorityName } .map { - case priorityName ~ t => + case (priorityName, t) => priorityName -> t.length } .list @@ -216,9 +215,11 @@ .on { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 => t1.byPriority(t6.userName, t6.repositoryName, t6.priorityId) } .joinLeft(PullRequests) .on { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 => t1.byIssue(t7.userName, t7.repositoryName, t7.issueId) } - .sortBy { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 => i asc } + .joinLeft(IssueAssignees) + .on { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 ~ t8 => t1.byIssue(t8.userName, t8.repositoryName, t8.issueId) } + .sortBy { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 ~ t8 => i asc } .map { - case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 => + case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 ~ t6 ~ t7 ~ t8 => ( t1, t2.commentCount, @@ -227,7 +228,8 @@ t4.map(_.color), t5.map(_.title), t6.map(_.priorityName), - t7.map(_.commitIdTo) + t7.map(_.commitIdTo), + t8.map(_.assigneeUserName) ) } .list @@ -237,7 +239,7 @@ result.map { issues => issues.head match { - case (issue, commentCount, _, _, _, milestone, priority, commitId) => + case (issue, commentCount, _, _, _, milestone, priority, commitId, _) => IssueInfo( issue, issues.flatMap { t => @@ -246,7 +248,8 @@ milestone, priority, commentCount, - commitId + commitId, + issues.flatMap(_._9) ) } } toList @@ -270,7 +273,7 @@ .map { case t1 ~ t2 ~ i ~ t3 ~ t4 ~ t5 => (t1, t3, t5) } .list .groupBy { - case (issue, account, assignedUsers) => + case (issue, account, _) => (issue, account) } .map { @@ -748,12 +751,12 @@ s: Session ): Int = { Issues.filter(_.byPrimaryKey(owner, repository, issueId)).map(_.updatedDate).update(currentDate) - IssueComments.filter(_.byPrimaryKey(commentId)).firstOption match { - case Some(c) if c.action == "reopen_comment" => + IssueComments.filter(_.byPrimaryKey(commentId)).first match { + case c if c.action == "reopen_comment" => IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.action)).update("Reopen", "reopen") - case Some(c) if c.action == "close_comment" => + case c if c.action == "close_comment" => IssueComments.filter(_.byPrimaryKey(commentId)).map(t => (t.content, t.action)).update("Close", "close") - case Some(_) => + case _ => IssueComments.filter(_.byPrimaryKey(commentId)).delete IssueComments insert IssueComment( userName = owner, @@ -1084,7 +1087,8 @@ milestone: Option[String], priority: Option[String], commentCount: Int, - commitId: Option[String] + commitId: Option[String], + assignees: Seq[String] ) } diff --git a/src/main/twirl/gitbucket/core/dashboard/issueslist.scala.html b/src/main/twirl/gitbucket/core/dashboard/issueslist.scala.html index d0ef372..4bf4fe1 100644 --- a/src/main/twirl/gitbucket/core/dashboard/issueslist.scala.html +++ b/src/main/twirl/gitbucket/core/dashboard/issueslist.scala.html @@ -17,7 +17,7 @@ - @issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId), status) => + @issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId, assignedUserNames), status) => @issue.userName/@issue.repositoryName ・ @@ -33,11 +33,9 @@ @label.labelName } - @* - @issue.assignedUserName.map { userName => + @assignedUserNames.map { userName => @helpers.avatar(userName, 20, tooltip = true) } - *@ @if(commentCount > 0){ @commentCount diff --git a/src/main/twirl/gitbucket/core/issues/listparts.scala.html b/src/main/twirl/gitbucket/core/issues/listparts.scala.html index 677cc0e..2c369e7 100644 --- a/src/main/twirl/gitbucket/core/issues/listparts.scala.html +++ b/src/main/twirl/gitbucket/core/issues/listparts.scala.html @@ -206,7 +206,7 @@ } - @issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId), status) => + @issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId, assignedUserNames), status) => @if(isManageable){ @@ -230,11 +230,9 @@ @label.labelName } - @* - @issue.assignedUserName.map { userName => + @assignedUserNames.map { userName => @helpers.avatar(userName, 20, tooltip = true) } - *@ @if(commentCount > 0){ @commentCount diff --git a/src/main/twirl/gitbucket/core/issues/milestones/listparts.scala.html b/src/main/twirl/gitbucket/core/issues/milestones/listparts.scala.html index cdbff56..bfe3d61 100644 --- a/src/main/twirl/gitbucket/core/issues/milestones/listparts.scala.html +++ b/src/main/twirl/gitbucket/core/issues/milestones/listparts.scala.html @@ -62,7 +62,7 @@ } - @issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId), status) => + @issues.map { case (IssueInfo(issue, labels, milestone, priority, commentCount, commitId, assignedUserNames), status) => @if(isManageable){ @@ -90,11 +90,9 @@ @label.labelName } - @* - @issue.assignedUserName.map { userName => + @assignedUserNames.map { userName => @helpers.avatar(userName, 20, tooltip = true) } - *@ @if(commentCount > 0){ @commentCount