diff --git a/src/main/resources/update/gitbucket-core_4.24.xml b/src/main/resources/update/gitbucket-core_4.24.xml
index 03249f541..5faaac3ac 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 a1245a419..3207e51ed 100644
--- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala
+++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala
@@ -562,7 +562,8 @@ trait RepositoryViewerControllerBase extends ControllerBase {
form.fileName,
form.oldLineNumber,
form.newLineNumber,
- form.issueId
+ form.issueId,
+ form.diff
)
form.issueId match {
case Some(issueId) =>
@@ -613,11 +614,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
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 328d64511..b4f081e18 100644
--- a/src/main/scala/gitbucket/core/model/Comment.scala
+++ b/src/main/scala/gitbucket/core/model/Comment.scala
@@ -54,6 +54,7 @@ trait CommitCommentComponent extends TemplateComponent { self: Profile =>
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 @@ trait CommitCommentComponent extends TemplateComponent { self: Profile =>
newLine,
registeredDate,
updatedDate,
- issueId
+ issueId,
+ diff
) <> (CommitComment.tupled, CommitComment.unapply)
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
@@ -86,7 +88,8 @@ case class CommitComment(
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 c3142c7b5..f4969ac4e 100644
--- a/src/main/scala/gitbucket/core/service/CommitsService.scala
+++ b/src/main/scala/gitbucket/core/service/CommitsService.scala
@@ -31,7 +31,8 @@ trait CommitsService {
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 @@ trait CommitsService {
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 2972ffa47..9dd3d15ae 100644
--- a/src/main/scala/gitbucket/core/service/PullRequestService.scala
+++ b/src/main/scala/gitbucket/core/service/PullRequestService.scala
@@ -163,9 +163,9 @@ trait PullRequestService { self: IssuesService with CommitsService =>
// 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 }