mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
Fix for #581. Column name and CSS is changed.
This commit is contained in:
@@ -10,7 +10,7 @@ CREATE TABLE COMMIT_COMMENT (
|
|||||||
NEW_LINE_NUMBER INT,
|
NEW_LINE_NUMBER INT,
|
||||||
REGISTERED_DATE TIMESTAMP NOT NULL,
|
REGISTERED_DATE TIMESTAMP NOT NULL,
|
||||||
UPDATED_DATE TIMESTAMP NOT NULL,
|
UPDATED_DATE TIMESTAMP NOT NULL,
|
||||||
IS_IN_PR BOOLEAN NOT NULL
|
PULL_REQUEST BOOLEAN NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
ALTER TABLE COMMIT_COMMENT ADD CONSTRAINT IDX_COMMIT_COMMENT_PK PRIMARY KEY (COMMENT_ID);
|
ALTER TABLE COMMIT_COMMENT ADD CONSTRAINT IDX_COMMIT_COMMENT_PK PRIMARY KEY (COMMENT_ID);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
oldLineNumber: Option[Int],
|
oldLineNumber: Option[Int],
|
||||||
newLineNumber: Option[Int],
|
newLineNumber: Option[Int],
|
||||||
content: String,
|
content: String,
|
||||||
isInPR: Boolean
|
pullRequest: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
val editorForm = mapping(
|
val editorForm = mapping(
|
||||||
@@ -79,11 +79,11 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
)(DeleteForm.apply)
|
)(DeleteForm.apply)
|
||||||
|
|
||||||
val commentForm = mapping(
|
val commentForm = mapping(
|
||||||
"fileName" -> trim(label("Filename", optional(text()))),
|
"fileName" -> trim(label("Filename", optional(text()))),
|
||||||
"oldLineNumber" -> trim(label("Old line number", optional(number()))),
|
"oldLineNumber" -> trim(label("Old line number", optional(number()))),
|
||||||
"newLineNumber" -> trim(label("New line number", optional(number()))),
|
"newLineNumber" -> trim(label("New line number", optional(number()))),
|
||||||
"content" -> trim(label("Content", text(required))),
|
"content" -> trim(label("Content", text(required))),
|
||||||
"isInPR" -> trim(label("Is in PR", boolean()))
|
"pullRequest" -> trim(label("In pull request", boolean()))
|
||||||
)(CommentForm.apply)
|
)(CommentForm.apply)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -247,20 +247,20 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
post("/:owner/:repository/commit/:id/comment/new", commentForm)(readableUsersOnly { (form, repository) =>
|
post("/:owner/:repository/commit/:id/comment/new", commentForm)(readableUsersOnly { (form, repository) =>
|
||||||
val id = params("id")
|
val id = params("id")
|
||||||
createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName, form.content,
|
createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName, form.content,
|
||||||
form.fileName, form.oldLineNumber, form.newLineNumber, form.isInPR)
|
form.fileName, form.oldLineNumber, form.newLineNumber, form.pullRequest)
|
||||||
recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
||||||
redirect(s"/${repository.owner}/${repository.name}/commit/${id}")
|
redirect(s"/${repository.owner}/${repository.name}/commit/${id}")
|
||||||
})
|
})
|
||||||
|
|
||||||
ajaxGet("/:owner/:repository/commit/:id/comment/_form")(readableUsersOnly { repository =>
|
ajaxGet("/:owner/:repository/commit/:id/comment/_form")(readableUsersOnly { repository =>
|
||||||
val id = params("id")
|
val id = params("id")
|
||||||
val fileName = params.get("fileName")
|
val fileName = params.get("fileName")
|
||||||
val oldLineNumber = params.get("oldLineNumber") flatMap {b => Some(b.toInt)}
|
val oldLineNumber = params.get("oldLineNumber") flatMap {b => Some(b.toInt)}
|
||||||
val newLineNumber = params.get("newLineNumber") flatMap {b => Some(b.toInt)}
|
val newLineNumber = params.get("newLineNumber") flatMap {b => Some(b.toInt)}
|
||||||
val isInPR = params.get("isInPR")
|
val pullRequest = params.get("pullRequest")
|
||||||
repo.html.commentform(
|
repo.html.commentform(
|
||||||
commitId = id,
|
commitId = id,
|
||||||
fileName, oldLineNumber, newLineNumber, isInPR.map(_.toBoolean).getOrElse(false),
|
fileName, oldLineNumber, newLineNumber, pullRequest.map(_.toBoolean).getOrElse(false),
|
||||||
hasWritePermission = hasWritePermission(repository.owner, repository.name, context.loginAccount),
|
hasWritePermission = hasWritePermission(repository.owner, repository.name, context.loginAccount),
|
||||||
repository = repository
|
repository = repository
|
||||||
)
|
)
|
||||||
@@ -269,7 +269,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
ajaxPost("/:owner/:repository/commit/:id/comment/_data/new", commentForm)(readableUsersOnly { (form, repository) =>
|
ajaxPost("/:owner/:repository/commit/:id/comment/_data/new", commentForm)(readableUsersOnly { (form, repository) =>
|
||||||
val id = params("id")
|
val id = params("id")
|
||||||
val commentId = createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName,
|
val commentId = createCommitComment(repository.owner, repository.name, id, context.loginAccount.get.userName,
|
||||||
form.content, form.fileName, form.oldLineNumber, form.newLineNumber, form.isInPR)
|
form.content, form.fileName, form.oldLineNumber, form.newLineNumber, form.pullRequest)
|
||||||
recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
recordCommentCommitActivity(repository.owner, repository.name, context.loginAccount.get.userName, id, form.content)
|
||||||
helper.html.commitcomment(getCommitComment(repository.owner, repository.name, commentId.toString).get,
|
helper.html.commitcomment(getCommitComment(repository.owner, repository.name, commentId.toString).get,
|
||||||
hasWritePermission(repository.owner, repository.name, context.loginAccount), repository)
|
hasWritePermission(repository.owner, repository.name, context.loginAccount), repository)
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ trait CommitCommentComponent extends TemplateComponent { self: Profile =>
|
|||||||
val newLine = column[Option[Int]]("NEW_LINE_NUMBER")
|
val newLine = column[Option[Int]]("NEW_LINE_NUMBER")
|
||||||
val registeredDate = column[java.util.Date]("REGISTERED_DATE")
|
val registeredDate = column[java.util.Date]("REGISTERED_DATE")
|
||||||
val updatedDate = column[java.util.Date]("UPDATED_DATE")
|
val updatedDate = column[java.util.Date]("UPDATED_DATE")
|
||||||
val isInPR = column[Boolean]("IS_IN_PR")
|
val pullRequest = column[Boolean]("PULL_REQUEST")
|
||||||
def * = (userName, repositoryName, commitId, commentId, commentedUserName, content, fileName, oldLine, newLine, registeredDate, updatedDate, isInPR) <> (CommitComment.tupled, CommitComment.unapply)
|
def * = (userName, repositoryName, commitId, commentId, commentedUserName, content, fileName, oldLine, newLine, registeredDate, updatedDate, pullRequest) <> (CommitComment.tupled, CommitComment.unapply)
|
||||||
|
|
||||||
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
|
def byPrimaryKey(commentId: Int) = this.commentId === commentId.bind
|
||||||
}
|
}
|
||||||
@@ -74,5 +74,5 @@ case class CommitComment(
|
|||||||
newLine: Option[Int],
|
newLine: Option[Int],
|
||||||
registeredDate: java.util.Date,
|
registeredDate: java.util.Date,
|
||||||
updatedDate: java.util.Date,
|
updatedDate: java.util.Date,
|
||||||
isInPR: Boolean
|
pullRequest: Boolean
|
||||||
) extends Comment
|
) extends Comment
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import util.StringUtil._
|
|||||||
|
|
||||||
trait CommitsService {
|
trait CommitsService {
|
||||||
|
|
||||||
def getCommitComments(owner: String, repository: String, commitId: String, isInPR: Boolean)(implicit s: Session) =
|
def getCommitComments(owner: String, repository: String, commitId: String, pullRequest: Boolean)(implicit s: Session) =
|
||||||
CommitComments filter {
|
CommitComments filter {
|
||||||
t => t.byCommit(owner, repository, commitId) && (t.isInPR === isInPR || isInPR)
|
t => t.byCommit(owner, repository, commitId) && (t.pullRequest === pullRequest || pullRequest)
|
||||||
} list
|
} list
|
||||||
|
|
||||||
def getCommitComment(owner: String, repository: String, commentId: String)(implicit s: Session) =
|
def getCommitComment(owner: String, repository: String, commentId: String)(implicit s: Session) =
|
||||||
@@ -26,7 +26,7 @@ trait CommitsService {
|
|||||||
None
|
None
|
||||||
|
|
||||||
def createCommitComment(owner: String, repository: String, commitId: String, loginUser: String,
|
def createCommitComment(owner: String, repository: String, commitId: String, loginUser: String,
|
||||||
content: String, fileName: Option[String], oldLine: Option[Int], newLine: Option[Int], isInPR: Boolean)(implicit s: Session): Int =
|
content: String, fileName: Option[String], oldLine: Option[Int], newLine: Option[Int], pullRequest: Boolean)(implicit s: Session): Int =
|
||||||
CommitComments.autoInc insert CommitComment(
|
CommitComments.autoInc insert CommitComment(
|
||||||
userName = owner,
|
userName = owner,
|
||||||
repositoryName = repository,
|
repositoryName = repository,
|
||||||
@@ -38,7 +38,7 @@ trait CommitsService {
|
|||||||
newLine = newLine,
|
newLine = newLine,
|
||||||
registeredDate = currentDate,
|
registeredDate = currentDate,
|
||||||
updatedDate = currentDate,
|
updatedDate = currentDate,
|
||||||
isInPR = isInPR)
|
pullRequest = pullRequest)
|
||||||
|
|
||||||
def updateCommitComment(commentId: Int, content: String)(implicit s: Session) =
|
def updateCommitComment(commentId: Int, content: String)(implicit s: Session) =
|
||||||
CommitComments
|
CommitComments
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@(comment: model.CommitComment,
|
@(comment: model.CommitComment,
|
||||||
hasWritePermission: Boolean,
|
hasWritePermission: Boolean,
|
||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
latestCommitId: Option[String] = None)(implicit context: app.Context)
|
latestCommitId: Option[String] = None)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
<div class="@if(comment.fileName.isDefined && (!latestCommitId.isDefined || latestCommitId.get == comment.commitId)){inline-comment}" @if(comment.fileName.isDefined){filename=@comment.fileName.get} @if(comment.newLine.isDefined){newline=@comment.newLine.get} @if(comment.oldLine.isDefined){oldline=@comment.oldLine.get}>
|
<div class="@if(comment.fileName.isDefined && (!latestCommitId.isDefined || latestCommitId.get == comment.commitId)){inline-comment}" @if(comment.fileName.isDefined){filename=@comment.fileName.get} @if(comment.newLine.isDefined){newline=@comment.newLine.get} @if(comment.oldLine.isDefined){oldline=@comment.oldLine.get}>
|
||||||
@@ -11,7 +11,7 @@ latestCommitId: Option[String] = None)(implicit context: app.Context)
|
|||||||
@user(comment.commentedUserName, styleClass="username strong")
|
@user(comment.commentedUserName, styleClass="username strong")
|
||||||
<span class="muted">
|
<span class="muted">
|
||||||
commented
|
commented
|
||||||
@if(comment.isInPR){
|
@if(comment.pullRequest){
|
||||||
on this Pull Request
|
on this Pull Request
|
||||||
}else{
|
}else{
|
||||||
@if(comment.fileName.isDefined){
|
@if(comment.fileName.isDefined){
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
@(diffs: Seq[util.JGitUtil.DiffInfo],
|
@(diffs: Seq[util.JGitUtil.DiffInfo],
|
||||||
repository: service.RepositoryService.RepositoryInfo,
|
repository: service.RepositoryService.RepositoryInfo,
|
||||||
newCommitId: Option[String],
|
newCommitId: Option[String],
|
||||||
oldCommitId: Option[String],
|
oldCommitId: Option[String],
|
||||||
showIndex: Boolean,
|
showIndex: Boolean,
|
||||||
isInPR: Boolean,
|
pullRequest: Boolean,
|
||||||
hasWritePermission: Boolean,
|
hasWritePermission: Boolean,
|
||||||
showLineNotes: Boolean)(implicit context: app.Context)
|
showLineNotes: Boolean)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@import org.eclipse.jgit.diff.DiffEntry.ChangeType
|
@import org.eclipse.jgit.diff.DiffEntry.ChangeType
|
||||||
@@ -157,7 +157,7 @@ $(function(){
|
|||||||
fileName = $(this).closest('.table-bordered').attr('fileName'),
|
fileName = $(this).closest('.table-bordered').attr('fileName'),
|
||||||
oldLineNumber = $(this).closest('.newline').prev('.oldline').text(),
|
oldLineNumber = $(this).closest('.newline').prev('.oldline').text(),
|
||||||
newLineNumber = $(this).closest('.newline').clone().children().remove().end().text(),
|
newLineNumber = $(this).closest('.newline').clone().children().remove().end().text(),
|
||||||
url = '@url(repository)/commit/' + commitId + '/comment/_form?fileName=' + fileName + '&isInPR=@isInPR';
|
url = '@url(repository)/commit/' + commitId + '/comment/_form?fileName=' + fileName + '&pullRequest=@pullRequest';
|
||||||
if (!isNaN(oldLineNumber) && oldLineNumber != null && oldLineNumber !== '') {
|
if (!isNaN(oldLineNumber) && oldLineNumber != null && oldLineNumber !== '') {
|
||||||
url += ('&oldLineNumber=' + oldLineNumber)
|
url += ('&oldLineNumber=' + oldLineNumber)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
@comments.get.flatMap @{
|
@comments.get.flatMap @{
|
||||||
case comment: model.CommitComment => Some(comment)
|
case comment: model.CommitComment => Some(comment)
|
||||||
case other => None
|
case other => None
|
||||||
}.count(t => t.commitId == commit.id && !t.isInPR)
|
}.count(t => t.commitId == commit.id && !t.pullRequest)
|
||||||
}</span>
|
}</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 10%; text-align: right;">
|
<td style="width: 10%; text-align: right;">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
fileName: Option[String] = None,
|
fileName: Option[String] = None,
|
||||||
oldLineNumber: Option[Int] = None,
|
oldLineNumber: Option[Int] = None,
|
||||||
newLineNumber: Option[Int] = None,
|
newLineNumber: Option[Int] = None,
|
||||||
isInPR: Boolean,
|
pullRequest: Boolean,
|
||||||
hasWritePermission: Boolean,
|
hasWritePermission: Boolean,
|
||||||
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<input type="submit" class="btn btn-success" formaction="@url(repository)/commit/@commitId/comment/new" value="Comment on this commit"/>
|
<input type="submit" class="btn btn-success" formaction="@url(repository)/commit/@commitId/comment/new" value="Comment on this commit"/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<input type="hidden" name="isInPR" value="@isInPR">
|
<input type="hidden" name="pullRequest" value="@pullRequest">
|
||||||
@if(fileName.isDefined){<input type="hidden" name="fileName" value="@fileName.get">}
|
@if(fileName.isDefined){<input type="hidden" name="fileName" value="@fileName.get">}
|
||||||
@if(oldLineNumber.isDefined){<input type="hidden" name="oldLineNumber" value="@oldLineNumber.get">}
|
@if(oldLineNumber.isDefined){<input type="hidden" name="oldLineNumber" value="@oldLineNumber.get">}
|
||||||
@if(newLineNumber.isDefined){<input type="hidden" name="newLineNumber" value="@newLineNumber.get">}
|
@if(newLineNumber.isDefined){<input type="hidden" name="newLineNumber" value="@newLineNumber.get">}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
<div id="comment-list">
|
<div id="comment-list">
|
||||||
@issues.html.commentlist(None, comments, hasWritePermission, repository, None)
|
@issues.html.commentlist(None, comments, hasWritePermission, repository, None)
|
||||||
</div>
|
</div>
|
||||||
@commentform(commitId = commitId, isInPR = false, hasWritePermission = hasWritePermission, repository = repository)
|
@commentform(commitId = commitId, pullRequest = false, hasWritePermission = hasWritePermission, repository = repository)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -964,7 +964,7 @@ table.diff thead {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table.inlinediff td.insert, table.inlinediff td.equal, table.inlinediff td.delete {
|
table.inlinediff td.insert, table.inlinediff td.equal, table.inlinediff td.delete {
|
||||||
width: 100%;
|
width: 900px;
|
||||||
}
|
}
|
||||||
|
|
||||||
td.insert, td.equal, td.delete, td.empty {
|
td.insert, td.equal, td.delete, td.empty {
|
||||||
|
|||||||
Reference in New Issue
Block a user