mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 19:15:59 +01:00
Grouping commit comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package gitbucket.core.controller
|
||||
|
||||
import gitbucket.core.model.{CommitComment, IssueComment, WebHook}
|
||||
import gitbucket.core.model.{CommitComment, CommitComments, IssueComment, WebHook}
|
||||
import gitbucket.core.plugin.PluginRegistry
|
||||
import gitbucket.core.pulls.html
|
||||
import gitbucket.core.service.CommitStatusService
|
||||
@@ -123,14 +123,22 @@ trait PullRequestsControllerBase extends ControllerBase {
|
||||
.flatten
|
||||
.toList ::: getComments(owner, name, issueId))
|
||||
.groupBy {
|
||||
case x: IssueComment => (None, None, None)
|
||||
case x: CommitComment => (x.fileName, x.oldLine, x.newLine)
|
||||
case x: IssueComment => (Some(x.commentId), None, None, None)
|
||||
case x: CommitComment => (None, x.fileName, x.oldLine, x.newLine)
|
||||
}
|
||||
.toSeq
|
||||
.sortWith {
|
||||
case ((key1, comments1), (key2, comments2)) =>
|
||||
comments1.head.registeredDate before comments2.head.registeredDate
|
||||
.toList
|
||||
.map {
|
||||
case ((Some(_), _, _, _), comments) =>
|
||||
comments.head
|
||||
case ((None, Some(fileName), _, _), comments) =>
|
||||
CommitComments(
|
||||
fileName = fileName,
|
||||
commentedUserName = comments.head.commentedUserName,
|
||||
registeredDate = comments.head.registeredDate,
|
||||
comments = comments.map(_.asInstanceOf[CommitComment])
|
||||
)
|
||||
}
|
||||
.sortWith(_.registeredDate before _.registeredDate)
|
||||
|
||||
html.pullreq(
|
||||
issue,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package gitbucket.core.model
|
||||
import java.util.Date
|
||||
|
||||
trait Comment {
|
||||
val commentedUserName: String
|
||||
@@ -87,3 +88,10 @@ case class CommitComment(
|
||||
updatedDate: java.util.Date,
|
||||
issueId: Option[Int]
|
||||
) extends Comment
|
||||
|
||||
case class CommitComments(
|
||||
fileName: String,
|
||||
commentedUserName: String,
|
||||
registeredDate: Date,
|
||||
comments: Seq[CommitComment]
|
||||
) extends Comment
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@(commits: Seq[Seq[gitbucket.core.util.JGitUtil.CommitInfo]],
|
||||
comments: Option[List[gitbucket.core.model.Comment]] = None,
|
||||
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
|
||||
@import gitbucket.core.view.helpers
|
||||
<table class="table table-bordered">
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</div>
|
||||
<div class="tab-pane" id="commits">
|
||||
@if(commits.nonEmpty){
|
||||
@gitbucket.core.pulls.html.commits(dayByDayCommits, Some(comments), repository)
|
||||
@gitbucket.core.pulls.html.commits(dayByDayCommits, repository)
|
||||
}
|
||||
</div>
|
||||
<div class="tab-pane" id="files">
|
||||
|
||||
Reference in New Issue
Block a user