@(issue: Option[gitbucket.core.model.Issue], comments: List[gitbucket.core.model.Comment], hasWritePermission: Boolean, repository: gitbucket.core.service.RepositoryService.RepositoryInfo, pullreq: Option[gitbucket.core.model.PullRequest] = None)(implicit context: gitbucket.core.controller.Context) @import context._ @import gitbucket.core.view.helpers._ @import gitbucket.core.model.CommitComment @if(issue.isDefined){
@avatar(issue.get.openedUserName, 48)
@user(issue.get.openedUserName, styleClass="username strong") commented @helper.html.datetimeago(issue.get.registeredDate) @if(hasWritePermission || loginAccount.map(_.userName == issue.get.openedUserName).getOrElse(false)){ }
@markdown(issue.get.content getOrElse "No description provided.", repository, false, true, true, hasWritePermission)
} @comments.map { case comment: gitbucket.core.model.IssueComment => { @if(comment.action != "close" && comment.action != "reopen" && comment.action != "delete_branch"){
@avatar(comment.commentedUserName, 48)
@user(comment.commentedUserName, styleClass="username strong") @if(comment.action == "comment"){ commented } else { @if(pullreq.isEmpty){ referenced the issue } else { referenced the pull request } } @helper.html.datetimeago(comment.registeredDate) @if(comment.action != "commit" && comment.action != "merge" && comment.action != "refer" && (hasWritePermission || loginAccount.map(_.userName == comment.commentedUserName).getOrElse(false))){ }
@if(comment.action == "commit" && comment.content.split(" ").last.matches("[a-f0-9]{40}")){ @defining(comment.content.substring(comment.content.length - 40)){ id =>
@id.substring(0, 7)
@markdown(comment.content.substring(0, comment.content.length - 41), repository, false, true, true, hasWritePermission) } } else { @if(comment.action == "refer"){ @defining(comment.content.split(":")){ case Array(issueId, rest @ _*) => Issue #@issueId: @rest.mkString(":") } } else { @markdown(comment.content, repository, false, true, true, hasWritePermission) } }
} @if(comment.action == "merge"){
Merged @avatar(comment.commentedUserName, 20) @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) } @helper.html.datetimeago(comment.registeredDate)
} @if(comment.action == "close" || comment.action == "close_comment"){
Closed @avatar(comment.commentedUserName, 20) @if(issue.isDefined && issue.get.isPullRequest){ @user(comment.commentedUserName, styleClass="username strong") closed the pull request @helper.html.datetimeago(comment.registeredDate) } else { @user(comment.commentedUserName, styleClass="username strong") closed the issue @helper.html.datetimeago(comment.registeredDate) }
} @if(comment.action == "reopen" || comment.action == "reopen_comment"){
Reopened @avatar(comment.commentedUserName, 20) @user(comment.commentedUserName, styleClass="username strong") reopened the issue @helper.html.datetimeago(comment.registeredDate)
} @if(comment.action == "delete_branch"){
Deleted @avatar(comment.commentedUserName, 20) @user(comment.commentedUserName, styleClass="username strong") deleted the @pullreq.map(_.requestBranch) branch @helper.html.datetimeago(comment.registeredDate)
} } case comment: CommitComment => { @helper.html.commitcomment(comment, hasWritePermission, repository, pullreq.map(_.commitIdTo)) } }