Fix comment header

This commit is contained in:
Naoki Takezoe
2018-04-27 17:33:56 +09:00
parent 110646fe9f
commit 332836119d
3 changed files with 33 additions and 12 deletions

View File

@@ -328,9 +328,10 @@ trait PullRequestService { self: IssuesService with CommitsService =>
.map(commit => getCommitComments(userName, repositoryName, commit.id, true))
.flatten ++ getComments(userName, repositoryName, issueId))
.groupBy {
case x: IssueComment => (Some(x.commentId), None, None, None)
case x: CommitComment => (None, x.fileName, x.oldLine, x.newLine)
case x => throw new MatchError(x)
case x: IssueComment => (Some(x.commentId), None, None, None)
case x: CommitComment if x.fileName.isEmpty => (Some(x.commentId), None, None, None)
case x: CommitComment => (None, x.fileName, x.oldLine, x.newLine)
case x => throw new MatchError(x)
}
.toSeq
.map {
@@ -353,9 +354,6 @@ trait PullRequestService { self: IssuesService with CommitsService =>
newLine
)
)
// Comment on a specific commit
case (_, comments) =>
comments.head // TODO In this case, something wrong in the presentation of the comments list.
}
.sortWith(_.registeredDate before _.registeredDate)
}

View File

@@ -6,9 +6,6 @@
<div class="panel panel-default">
<div class="panel-heading">
<span class="monospace">@comments.fileName</span>
<span class="pull-right">
<a href="@helpers.url(repository)/commit/@comments.comments.head.commitId" class="monospace">@comments.comments.head.commitId.substring(0, 7)</a>
</span>
</div>
@comments.diff.map(helpers.diff)
<div class="panel-body">

View File

@@ -236,9 +236,35 @@
@gitbucket.core.helper.html.commitcomments(comments, isManageable, repository, pullreq.map(_.commitIdTo))
}
case comment: gitbucket.core.model.CommitComment => {
@gitbucket.core.helper.html.commitcomments(gitbucket.core.model.CommitComments(
comment.fileName.getOrElse(""), comment.commentedUserName, comment.registeredDate, Seq(comment), None
), isManageable, repository, pullreq.map(_.commitIdTo))
<div class="panel panel-default issue-comment-box" id="comment-@comment.commentId">
<div class="panel-heading">
@helpers.avatar(comment.commentedUserName, 20)
@helpers.user(comment.commentedUserName, styleClass="username strong")
<span class="muted">
commented
<a href="#comment-@comment.commentId">@gitbucket.core.helper.html.datetimeago(comment.registeredDate)</a>
on
<a href="@helpers.url(repository)/commit/@comment.commitId" class="monospace">@comment.commitId.substring(0, 7)</a>
</span>
@if((isManageable || context.loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){
<span class="pull-right">
<a href="#" data-comment-id="@comment.commentId"><i class="octicon octicon-pencil" aria-label="Edit"></i></a>&nbsp;
<a href="#" data-comment-id="@comment.commentId"><i class="octicon octicon-x" aria-label="Remove"></i></a>
</span>
}
</div>
<div class="panel-body markdown-body" id="commentContent-@comment.commentId">
@helpers.markdown(
markdown = comment.content,
repository = repository,
enableWikiLink = false,
enableRefsLink = true,
enableLineBreaks = true,
enableTaskList = true,
hasWritePermission = isManageable
)
</div>
</div>
}
}
<script>