Show commit status at commits tab of pull request (#2606)

This commit is contained in:
Naoki Takezoe
2020-12-25 22:34:47 +09:00
committed by GitHub
parent 2a3c8e0712
commit 66be84289d
2 changed files with 14 additions and 5 deletions

View File

@@ -169,10 +169,16 @@ trait PullRequestsControllerBase extends ControllerBase {
val (commits, diffs) = val (commits, diffs) =
getRequestCompareInfo(owner, name, pullreq.commitIdFrom, owner, name, pullreq.commitIdTo) getRequestCompareInfo(owner, name, pullreq.commitIdFrom, owner, name, pullreq.commitIdTo)
val commitsWithStatus = commits.map { day =>
day.map { commit =>
(commit, getCommitStatusWithSummary(repository.owner, repository.name, commit.id))
}
}
html.commits( html.commits(
issue, issue,
pullreq, pullreq,
commits, commitsWithStatus,
getPullRequestComments(owner, name, issue.issueId, commits.flatten), getPullRequestComments(owner, name, issue.issueId, commits.flatten),
diffs.size, diffs.size,
isManageable(repository), isManageable(repository),

View File

@@ -1,17 +1,17 @@
@(issue: gitbucket.core.model.Issue, @(issue: gitbucket.core.model.Issue,
pullreq: gitbucket.core.model.PullRequest, pullreq: gitbucket.core.model.PullRequest,
commits: Seq[Seq[gitbucket.core.util.JGitUtil.CommitInfo]], commits: Seq[Seq[(gitbucket.core.util.JGitUtil.CommitInfo, Option[(gitbucket.core.model.CommitState, List[gitbucket.core.model.CommitStatus])])]],
comments: Seq[gitbucket.core.model.Comment], comments: Seq[gitbucket.core.model.Comment],
changedFileSize: Int, changedFileSize: Int,
isManageable: Boolean, isManageable: Boolean,
repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context) repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers @import gitbucket.core.view.helpers
@gitbucket.core.pulls.html.menu("commits", issue, pullreq, commits.flatten, comments, changedFileSize, isManageable, repository){ @gitbucket.core.pulls.html.menu("commits", issue, pullreq, commits.flatten.map(_._1), comments, changedFileSize, isManageable, repository){
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
@commits.map { day => @commits.map { day =>
<tr> <tr>
<th rowspan="@day.size" width="100">@helpers.date(day.head.commitTime)</th> <th rowspan="@day.size" width="100">@helpers.date(day.head._1.commitTime)</th>
@day.zipWithIndex.map { case (commit, i) => @day.zipWithIndex.map { case ((commit, status), i) =>
@if(i != 0){ <tr> } @if(i != 0){ <tr> }
<td> <td>
<div class="pull-right text-right"> <div class="pull-right text-right">
@@ -37,6 +37,9 @@
} }
@helpers.user(commit.committerName, commit.committerEmailAddress, "username") @helpers.user(commit.committerName, commit.committerEmailAddress, "username")
<span class="muted">committed @gitbucket.core.helper.html.datetimeago(commit.commitTime)</span> <span class="muted">committed @gitbucket.core.helper.html.datetimeago(commit.commitTime)</span>
@status.map { case (summary, statuses) =>
@gitbucket.core.helper.html.commitstatus(commit.id, summary, statuses)
}
</div> </div>
</div> </div>
</div> </div>