Add the commit link to refs comment.

This commit is contained in:
takezoe
2013-10-24 04:25:50 +09:00
parent 0d0bf4ad3f
commit 2968b92677
2 changed files with 9 additions and 2 deletions

View File

@@ -149,7 +149,7 @@ class CommitLogHook(owner: String, repository: String, userName: String, baseURL
"(^|\\W)#(\\d+)(\\W|$)".r.findAllIn(commit.fullMessage).matchData.foreach { matchData => "(^|\\W)#(\\d+)(\\W|$)".r.findAllIn(commit.fullMessage).matchData.foreach { matchData =>
val issueId = matchData.group(2) val issueId = matchData.group(2)
if(getAccountByUserName(commit.committer).isDefined && getIssue(owner, repository, issueId).isDefined){ if(getAccountByUserName(commit.committer).isDefined && getIssue(owner, repository, issueId).isDefined){
createComment(owner, repository, commit.committer, issueId.toInt, commit.fullMessage, "commit") createComment(owner, repository, commit.committer, issueId.toInt, commit.id + " " + commit.fullMessage, "commit")
} }
} }
} }

View File

@@ -21,7 +21,14 @@
</span> </span>
</div> </div>
<div class="box-content"class="issue-content" id="commentContent-@comment.commentId"> <div class="box-content"class="issue-content" id="commentContent-@comment.commentId">
@markdown(comment.content, repository, false, true) @if(comment.action == "commit" && comment.content.split(" ").last.matches("[a-f0-9]{40}")){
@defining(comment.content.substring(comment.content.length - 40)){ id =>
<div class="pull-right"><a href="@path/@repository.owner/@repository.name/commit/@id" class="monospace">@id.substring(0, 7)</a></div>
@markdown(comment.content.substring(0, comment.content.length - 41), repository, false, true)
}
} else {
@markdown(comment.content, repository, false, true)
}
</div> </div>
</div> </div>
} }