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