Fix comment list in the commit page

This commit is contained in:
Naoki Takezoe
2018-04-20 02:35:41 +09:00
parent 10cec316ee
commit f62f83888c
2 changed files with 53 additions and 1 deletions

View File

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

View File

@@ -1,3 +1,4 @@
@import gitbucket.core.model.CommitComment
@(commitId: String, @(commitId: String,
commit: gitbucket.core.util.JGitUtil.CommitInfo, commit: gitbucket.core.util.JGitUtil.CommitInfo,
branches: List[String], branches: List[String],
@@ -87,7 +88,20 @@
<input type="checkbox" id="show-notes"> Show line notes below <input type="checkbox" id="show-notes"> Show line notes below
</label> </label>
<div id="comment-list"> <div id="comment-list">
@gitbucket.core.issues.html.commentlist(None, comments, hasWritePermission, repository, None) @gitbucket.core.issues.html.commentlist(
None,
comments.filter(_.asInstanceOf[gitbucket.core.model.CommitComment].fileName.isEmpty),
hasWritePermission,
repository,
None)
<div style="display: none;">
@gitbucket.core.issues.html.commentlist(
None,
comments.filter(_.asInstanceOf[gitbucket.core.model.CommitComment].fileName.isDefined),
hasWritePermission,
repository,
None)
</div>
</div> </div>
@gitbucket.core.repo.html.commentform(commitId = commitId, hasWritePermission = hasWritePermission, repository = repository) @gitbucket.core.repo.html.commentform(commitId = commitId, hasWritePermission = hasWritePermission, repository = repository)
} }