(refs #2)Add action type "merge" for ISSUE_COMMENT.

This commit is contained in:
takezoe
2013-08-05 15:16:26 +09:00
parent b58c19b88b
commit 50cb59f569
4 changed files with 32 additions and 16 deletions

View File

@@ -105,7 +105,8 @@ trait PullRequestsControllerBase extends ControllerBase {
try { try {
// TODO mark issue as 'merged' // TODO mark issue as 'merged'
val loginAccount = context.loginAccount.get val loginAccount = context.loginAccount.get
createComment(repository.owner, repository.name, loginAccount.userName, issueId, "Closed", "close") createComment(repository.owner, repository.name, loginAccount.userName, issueId, "Merge", "merge")
createComment(repository.owner, repository.name, loginAccount.userName, issueId, "Close", "close")
updateClosed(repository.owner, repository.name, issueId, true) updateClosed(repository.owner, repository.name, issueId, true)
recordMergeActivity(repository.owner, repository.name, loginAccount.userName, issueId, form.message) recordMergeActivity(repository.owner, repository.name, loginAccount.userName, issueId, form.message)

View File

@@ -116,12 +116,14 @@
@if(comment.action == "close" || comment.action == "close_comment"){ @if(comment.action == "close" || comment.action == "close_comment"){
<div class="small issue-comment-action"> <div class="small issue-comment-action">
<span class="label label-important">Closed</span> <span class="label label-important">Closed</span>
@avatar(comment.commentedUserName, 20)
<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)
</div> </div>
} }
@if(comment.action == "reopen" || comment.action == "reopen_comment"){ @if(comment.action == "reopen" || comment.action == "reopen_comment"){
<div class="small issue-comment-action"> <div class="small issue-comment-action">
<span class="label label-success">Reopened</span> <span class="label label-success">Reopened</span>
@avatar(comment.commentedUserName, 20)
<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>
} }

View File

@@ -61,6 +61,7 @@
</div> </div>
</div> </div>
@comments.map { comment => @comments.map { comment =>
@if(comment.action != "close" && comment.action != "reopen" && comment.action != "merge"){
<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">
@@ -77,20 +78,28 @@
@markdown(comment.content, repository, false, true) @markdown(comment.content, repository, false, true)
</div> </div>
</div> </div>
<div class="small issue-comment-action"> }
@if(comment.action == "merge"){
<div class="small" style="margin-top: 10px; margin-bottom: 10px;">
<span class="label label-info">Merged</span>
@avatar(comment.commentedUserName, 20)
<a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> merged the pull request @datetime(comment.registeredDate)
</div>
}
@if(comment.action == "close" || comment.action == "close_comment"){ @if(comment.action == "close" || comment.action == "close_comment"){
<div class="small issue-comment-action"> <div class="small issue-comment-action">
<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) @avatar(comment.commentedUserName, 20)
<a href="@url(comment.commentedUserName)" class="username strong">@comment.commentedUserName</a> closed the pull request @datetime(comment.registeredDate)
</div> </div>
} }
@if(comment.action == "reopen" || comment.action == "reopen_comment"){ @if(comment.action == "reopen" || comment.action == "reopen_comment"){
<div class="small issue-comment-action"> <div class="small issue-comment-action">
<span class="label label-success">Reopened</span> <span class="label label-success">Reopened</span>
@avatar(comment.commentedUserName, 20)
<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>
} }
</div>
} }
@if(hasWritePermission && !issue.closed){ @if(hasWritePermission && !issue.closed){
<div class="box issue-comment-box" style="background-color: #d8f5cd;"> <div class="box issue-comment-box" style="background-color: #d8f5cd;">
@@ -184,7 +193,11 @@ git push origin @{pullreq.branch}</pre>
</div> </div>
<div class="span2"> <div class="span2">
@if(issue.closed) { @if(issue.closed) {
@if(comments.exists(_.action == "merge")){
<span class="label label-info issue-status">Merged</span>
} else {
<span class="label label-important issue-status">Closed</span> <span class="label label-important issue-status">Closed</span>
}
} else { } else {
<span class="label label-success issue-status">Open</span> <span class="label label-success issue-status">Open</span>
} }

View File

@@ -13,7 +13,7 @@
@import context._ @import context._
@import view.helpers._ @import view.helpers._
@html.main("%s - Pull Request #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){ @html.main("%s - Pull Request #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){
@html.header("issues", repository) @html.header("pulls", repository)
<ul class="nav nav-tabs" id="pullreq-tab"> <ul class="nav nav-tabs" id="pullreq-tab">
<li class="active"><a href="#discussion">Discussion</a></li> <li class="active"><a href="#discussion">Discussion</a></li>
<li><a href="#commits">Commits <span class="badge">@commits.flatten.size</span></a></li> <li><a href="#commits">Commits <span class="badge">@commits.flatten.size</span></a></li>