mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-04 14:50:02 +01:00
Store diff JSON data into the database
This commit is contained in:
@@ -7,4 +7,8 @@
|
||||
|
||||
<addPrimaryKey constraintName="IDX_ACCOUNT_EXTRA_MAIL_ADDRESS_PK" tableName="ACCOUNT_EXTRA_MAIL_ADDRESS" columnNames="USER_NAME, EXTRA_MAIL_ADDRESS"/>
|
||||
<addUniqueConstraint constraintName="IDX_ACCOUNT_EXTRA_MAIL_ADDRESS_1" tableName="ACCOUNT_EXTRA_MAIL_ADDRESS" columnNames="EXTRA_MAIL_ADDRESS"/>
|
||||
|
||||
<addColumn tableName="COMMIT_COMMENT">
|
||||
<column name="DIFF" type="text" nullable="true" />
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
@@ -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) =>
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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])(
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user