Bug fix for non-inline commit comment

This commit is contained in:
Naoki Takezoe
2018-04-29 11:33:59 +09:00
parent eef01262bd
commit 1ea0e827a5
4 changed files with 39 additions and 37 deletions

View File

@@ -3,7 +3,7 @@
repository: gitbucket.core.service.RepositoryService.RepositoryInfo,
latestCommitId: Option[String] = None)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
<div class="commit-comment-box @if((!latestCommitId.isDefined || latestCommitId.get == comment.commitId)){inline-comment}" id="discussion_r@comment.commentId"
<div class="commit-comment-box @if(latestCommitId.contains(comment.commitId)){inline-comment}" id="discussion_r@comment.commentId"
@if(comment.fileName.isDefined){filename="@comment.fileName.get"}
@if(comment.newLine.isDefined){newline="@comment.newLine.get"}
@if(comment.oldLine.isDefined){oldline="@comment.oldLine.get"}>

View File

@@ -7,10 +7,10 @@
<div class="panel-heading">
<span class="monospace">@comments.fileName</span>
@if(!latestCommitId.contains(comments.comments.head.commitId)) {
<span class="pull-right"><a href="javascript:$('.outdated-comments-@comments.comments.head.commentId').toggle();"><i class="octicon octicon-unfold"></i></a></span>
<span class="pull-right"><a href="javascript:$('.fold-comments-@comments.comments.head.commentId').toggle();"><i class="octicon octicon-unfold"></i></a></span>
}
</div>
<div style="@if(!latestCommitId.contains(comments.comments.head.commitId)){display: none;}" class="outdated-comments-@comments.comments.head.commentId">
<div style="@if(!latestCommitId.contains(comments.comments.head.commitId)){display: none;}" class="fold-comments-@comments.comments.head.commentId">
@comments.diff.map(helpers.diff)
<div class="panel-body">
@comments.comments.map { comment =>

View File

@@ -22,23 +22,23 @@
elastic = true,
tabIndex = 1
)
<div class="text-right">
<input type="hidden" name="issueId" value="@issue.issueId"/>
@if((reopenable || !issue.closed) && (isManageable || issue.openedUserName == context.loginAccount.get.userName)){
<input type="hidden" id="action" name="action" value="comment"/>
<div class="btn-group dropup">
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment" id="submit-button"/>
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a id="menu-comment">Comment</a></li>
<li><a id="menu-x-and-comment">@{if(issue.closed) "Reopen" else "Close"} and comment</a></li>
</ul>
</div>
} else {
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment"/>
}
<div class="text-right">
<input type="hidden" name="issueId" value="@issue.issueId"/>
@if((reopenable || !issue.closed) && (isManageable || issue.openedUserName == context.loginAccount.get.userName)){
<input type="hidden" id="action" name="action" value="comment"/>
<div class="btn-group dropup">
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment" id="submit-button"/>
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a id="menu-comment">Comment</a></li>
<li><a id="menu-x-and-comment">@{if(issue.closed) "Reopen" else "Close"} and comment</a></li>
</ul>
</div>
} else {
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment"/>
}
</div>
</div>
</div>

View File

@@ -236,16 +236,16 @@
@gitbucket.core.helper.html.commitcomments(comments, isManageable, repository, pullreq.map(_.commitIdTo))
}
case comment: gitbucket.core.model.CommitComment => {
<div class="panel panel-default issue-comment-box" id="comment-@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
<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>
<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;
@@ -253,16 +253,16 @@
</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 class="panel-body markdown-body commit-commentContent-@comment.commentId">
@helpers.markdown(
markdown = comment.content,
repository = repository,
enableWikiLink = false,
enableRefsLink = true,
enableLineBreaks = true,
enableTaskList = true,
hasWritePermission = isManageable
)
</div>
</div>
}
@@ -334,6 +334,8 @@ $(function(){
if(panel.has('.commit-comment-box').length == 0){
panel.remove();
}
} else {
comment.remove();
}
}
});