(refs #11) Fix comments to display.

This commit is contained in:
shimamoto
2013-07-17 13:56:54 +09:00
parent ac784f8905
commit d866847c0d
2 changed files with 19 additions and 11 deletions

View File

@@ -102,7 +102,10 @@ trait IssuesService {
// get issues and comment count // get issues and comment count
val issues = searchIssueQuery(owner, repository, condition, filter, userName) val issues = searchIssueQuery(owner, repository, condition, filter, userName)
.leftJoin(Query(IssueComments) .leftJoin(Query(IssueComments)
.filter { _.byRepository(owner, repository) } .filter { t =>
(t.byRepository(owner, repository)) &&
(t.action inSetBind Seq("comment", "close_comment", "reopen_comment"))
}
.groupBy { _.issueId } .groupBy { _.issueId }
.map { case (issueId, t) => issueId ~ t.length }).on((t1, t2) => t1.issueId is t2._1) .map { case (issueId, t) => issueId ~ t.length }).on((t1, t2) => t1.issueId is t2._1)
.sortBy { case (t1, t2) => .sortBy { case (t1, t2) =>

View File

@@ -69,6 +69,7 @@
</div> </div>
</div> </div>
@comments.map { comment => @comments.map { comment =>
@if(comment.action != "close" && comment.action != "reopen"){
<div class="issue-avatar-image">@avatar(comment.commentedUserName, 48)</div> <div class="issue-avatar-image">@avatar(comment.commentedUserName, 48)</div>
<div class="box issue-comment-box" id="comment-@comment.commentId"> <div class="box issue-comment-box" id="comment-@comment.commentId">
<div class="box-header-small"> <div class="box-header-small">
@@ -76,7 +77,7 @@
<a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> commented <a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> commented
<span class="pull-right"> <span class="pull-right">
@datetime(comment.registeredDate) @datetime(comment.registeredDate)
@if(hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false)){ @if(comment.action != "commit" && (hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){
<a href="#" data-comment-id="@comment.commentId"><i class="icon-pencil"></i></a> <a href="#" data-comment-id="@comment.commentId"><i class="icon-pencil"></i></a>
} }
</span> </span>
@@ -85,15 +86,17 @@
@markdown(comment.content, repository, false, true) @markdown(comment.content, repository, false, true)
</div> </div>
</div> </div>
@comment.action.map { action => }
@if(comment.action == "close" || comment.action == "close_comment"){
<div class="small issue-comment-action"> <div class="small issue-comment-action">
@if(action == "close"){
<span class="label label-important">Closed</span> <span class="label label-important">Closed</span>
<a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> closed the issue @datetime(comment.registeredDate) <a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> closed the issue @datetime(comment.registeredDate)
} else { </div>
}
@if(comment.action == "reopen" || comment.action == "reopen_comment"){
<div class="small issue-comment-action">
<span class="label label-success">Reopened</span> <span class="label label-success">Reopened</span>
<a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> reopened the issue @datetime(comment.registeredDate) <a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> reopened the issue @datetime(comment.registeredDate)
}
</div> </div>
} }
} }
@@ -122,7 +125,9 @@
<span class="label label-success issue-status">Open</span> <span class="label label-success issue-status">Open</span>
} }
<div class="small" style="text-align: center;"> <div class="small" style="text-align: center;">
<strong>@comments.size</strong> @plural(comments.size, "comment") @defining(comments.filter( _.action.contains("comment") ).size){ count =>
<strong>@count</strong> @plural(count, "comment")
}
</div> </div>
<hr/> <hr/>
<div style="margin-bottom: 8px;"> <div style="margin-bottom: 8px;">