@(issue: Option[gitbucket.core.model.Issue], comments: List[gitbucket.core.model.Comment], isManageable: Boolean, repository: gitbucket.core.service.RepositoryService.RepositoryInfo, pullreq: Option[gitbucket.core.model.PullRequest] = None)(implicit context: gitbucket.core.controller.Context) @import gitbucket.core.view.helpers @import gitbucket.core.model.CommitComment @if(issue.isDefined){
@helpers.avatar(issue.get.openedUserName, 20) @helpers.user(issue.get.openedUserName, styleClass="username strong") commented @gitbucket.core.helper.html.datetimeago(issue.get.registeredDate) @if(isManageable || context.loginAccount.map(_.userName == issue.get.openedUserName).getOrElse(false)){ }
@helpers.markdown( markdown = issue.get.content getOrElse "No description provided.", repository = repository, enableWikiLink = false, enableRefsLink = true, enableLineBreaks = true, enableTaskList = true, hasWritePermission = isManageable )
} @issueOrPullRequest()={ @if(issue.exists(_.isPullRequest))( "pull request" )else( "issue" ) } @comments.map { case comment: gitbucket.core.model.IssueComment => { @if(comment.action != "close" && comment.action != "reopen" && comment.action != "delete_branch" && comment.action != "commit" && comment.action != "refer"){
@helpers.avatar(comment.commentedUserName, 20) @helpers.user(comment.commentedUserName, styleClass="username strong") @if(comment.action == "comment"){ commented } else { referenced the @issueOrPullRequest() } @gitbucket.core.helper.html.datetimeago(comment.registeredDate) @if(comment.action != "commit" && comment.action != "merge" && comment.action != "refer" && (isManageable || context.loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){ }
@helpers.markdown( markdown = comment.content, repository = repository, enableWikiLink = false, enableRefsLink = true, enableLineBreaks = true, enableTaskList = true, hasWritePermission = isManageable )
} @if(comment.action == "commit"){ @defining({ val (content, id) = " ([a-f0-9]{40})$".r.findFirstMatchIn(comment.content) .map(m => (m.before.toString -> Some(m.group(1)))) .getOrElse(comment.content -> None) val head = content.take(100).takeWhile(_ != '\n') (id, head, if(head == content){ None }else{ Some(content.drop(head.length).dropWhile(_ == '\n')) }.filter(_.nonEmpty)) }){ case (commitId, head, rest) =>
@helpers.avatar(comment.commentedUserName, 16) @helpers.user(comment.commentedUserName, styleClass="username strong") added a commit that referenced this @issueOrPullRequest() @gitbucket.core.helper.html.datetimeago(comment.registeredDate)
@commitId.map{ id => @id.substring(0, 7) } @helpers.link(head, repository) @rest.map{ content => ...

    @helpers.link(content, repository)

}
} } @if(comment.action == "refer"){
@helpers.avatar(comment.commentedUserName, 16) @helpers.user(comment.commentedUserName, styleClass="username strong") referenced the @issueOrPullRequest() @gitbucket.core.helper.html.datetimeago(comment.registeredDate)
@defining(comment.content.split(":")){ case Array(issueId, rest @ _*) => @helpers.issueLink(repository, issueId.toInt): @rest.mkString(":") }
} @if(comment.action == "merge"){
@helpers.avatar(comment.commentedUserName, 16) @helpers.user(comment.commentedUserName, styleClass="username strong") merged commit `@pullreq.map(_.commitIdTo.substring(0, 7))` into @if(pullreq.get.requestUserName == repository.owner){ `@pullreq.map(_.branch)` from `@pullreq.map(_.requestBranch)` } else { `@pullreq.map(_.userName):@pullreq.map(_.branch)` from `@pullreq.map(_.requestUserName):@pullreq.map(_.requestBranch)` } @gitbucket.core.helper.html.datetimeago(comment.registeredDate)
} @if(comment.action == "close" || comment.action == "close_comment"){
@helpers.avatar(comment.commentedUserName, 16) @helpers.user(comment.commentedUserName, styleClass="username strong") closed this @issueOrPullRequest() @gitbucket.core.helper.html.datetimeago(comment.registeredDate)
} @if(comment.action == "reopen" || comment.action == "reopen_comment"){
@helpers.avatar(comment.commentedUserName, 16) @helpers.user(comment.commentedUserName, styleClass="username strong") reopened the @issueOrPullRequest() @gitbucket.core.helper.html.datetimeago(comment.registeredDate)
} @if(comment.action == "delete_branch"){
@helpers.avatar(comment.commentedUserName, 16) @helpers.user(comment.commentedUserName, styleClass="username strong") deleted the `@pullreq.map(_.requestBranch)` branch @gitbucket.core.helper.html.datetimeago(comment.registeredDate)
} } case comment: CommitComment => { @gitbucket.core.helper.html.commitcomment(comment, isManageable, repository, pullreq.map(_.commitIdTo)) } }