diff --git a/src/main/resources/update/gitbucket-core_4.24.xml b/src/main/resources/update/gitbucket-core_4.24.xml
index 03249f5..5faaac3 100644
--- a/src/main/resources/update/gitbucket-core_4.24.xml
+++ b/src/main/resources/update/gitbucket-core_4.24.xml
@@ -7,4 +7,8 @@
+
+
+
+
diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala
index a1245a4..3207e51 100644
--- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala
+++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala
@@ -562,7 +562,8 @@
form.fileName,
form.oldLineNumber,
form.newLineNumber,
- form.issueId
+ form.issueId,
+ form.diff
)
form.issueId match {
case Some(issueId) =>
@@ -613,11 +614,10 @@
form.fileName,
form.oldLineNumber,
form.newLineNumber,
- form.issueId
+ form.issueId,
+ form.diff
)
- println(form.diff) // TODO store diff into the database
-
val comment = getCommitComment(repository.owner, repository.name, commentId.toString).get
form.issueId match {
case Some(issueId) =>
diff --git a/src/main/scala/gitbucket/core/model/Comment.scala b/src/main/scala/gitbucket/core/model/Comment.scala
index 328d645..b4f081e 100644
--- a/src/main/scala/gitbucket/core/model/Comment.scala
+++ b/src/main/scala/gitbucket/core/model/Comment.scala
@@ -54,6 +54,7 @@
val registeredDate = column[java.util.Date]("REGISTERED_DATE")
val updatedDate = column[java.util.Date]("UPDATED_DATE")
val issueId = column[Option[Int]]("ISSUE_ID")
+ val diff = column[Option[String]]("DIFF")
def * =
(
userName,
@@ -67,7 +68,8 @@
newLine,
registeredDate,
updatedDate,
- issueId
+ issueId,
+ diff
) <> (CommitComment.tupled, CommitComment.unapply)
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
@@ -86,7 +88,8 @@
newLine: Option[Int],
registeredDate: java.util.Date,
updatedDate: java.util.Date,
- issueId: Option[Int]
+ issueId: Option[Int],
+ diff: Option[String]
) extends Comment
case class CommitComments(
diff --git a/src/main/scala/gitbucket/core/service/CommitsService.scala b/src/main/scala/gitbucket/core/service/CommitsService.scala
index c3142c7..f4969ac 100644
--- a/src/main/scala/gitbucket/core/service/CommitsService.scala
+++ b/src/main/scala/gitbucket/core/service/CommitsService.scala
@@ -31,7 +31,8 @@
fileName: Option[String],
oldLine: Option[Int],
newLine: Option[Int],
- issueId: Option[Int]
+ issueId: Option[Int],
+ diff: Option[String]
)(implicit s: Session): Int =
CommitComments returning CommitComments.map(_.commentId) insert CommitComment(
userName = owner,
@@ -44,7 +45,8 @@
newLine = newLine,
registeredDate = currentDate,
updatedDate = currentDate,
- issueId = issueId
+ issueId = issueId,
+ diff = diff
)
def updateCommitCommentPosition(commentId: Int, commitId: String, oldLine: Option[Int], newLine: Option[Int])(
diff --git a/src/main/scala/gitbucket/core/service/PullRequestService.scala b/src/main/scala/gitbucket/core/service/PullRequestService.scala
index 2972ffa..9dd3d15 100644
--- a/src/main/scala/gitbucket/core/service/PullRequestService.scala
+++ b/src/main/scala/gitbucket/core/service/PullRequestService.scala
@@ -163,9 +163,9 @@
// Collect comment positions
val positions = getCommitComments(pullreq.userName, pullreq.repositoryName, pullreq.commitIdTo, true)
.collect {
- case CommitComment(_, _, _, commentId, _, _, Some(file), None, Some(newLine), _, _, _) =>
+ case CommitComment(_, _, _, commentId, _, _, Some(file), None, Some(newLine), _, _, _, _) =>
(file, commentId, Right(newLine))
- case CommitComment(_, _, _, commentId, _, _, Some(file), Some(oldLine), None, _, _, _) =>
+ case CommitComment(_, _, _, commentId, _, _, Some(file), Some(oldLine), None, _, _, _, _) =>
(file, commentId, Left(oldLine))
}
.groupBy { case (file, _, _) => file }