(refs #2)Add the details page for the pull request.

This commit is contained in:
takezoe
2013-07-14 03:01:46 +09:00
parent 0903721a62
commit 9048e07b6b

View File

@@ -13,11 +13,11 @@ import scala.Some
import util.JGitUtil.CommitInfo
class PullRequestsController extends PullRequestsControllerBase
with RepositoryService with AccountService with IssuesService with PullRequestService
with RepositoryService with AccountService with IssuesService with PullRequestService with MilestonesService
with ReferrerAuthenticator with CollaboratorsAuthenticator
trait PullRequestsControllerBase extends ControllerBase {
self: ReferrerAuthenticator with RepositoryService with IssuesService
self: ReferrerAuthenticator with RepositoryService with IssuesService with MilestonesService
with PullRequestService with CollaboratorsAuthenticator =>
val form = mapping(
@@ -133,6 +133,28 @@ trait PullRequestsControllerBase extends ControllerBase {
redirect(s"/${repository.owner}/${repository.name}/pulls/${issueId}")
})
get("/:owner/:repository/pulls/:id")(referrersOnly { repository =>
val owner = repository.owner
val name = repository.name
val issueId = params("id")
getIssue(owner, name, issueId) map {
issues.html.issue(
_,
getComments(owner, name, issueId.toInt),
getIssueLabels(owner, name, issueId.toInt),
(getCollaborators(owner, name) :+ owner).sorted,
getMilestones(owner, name),
Nil,
hasWritePermission(owner, name, context.loginAccount),
repository)
} getOrElse NotFound
})
post("/:owner/:repository/pulls/:id/merge")(collaboratorsOnly { repository =>
// TODO Not implemented yet.
})
private def withGit[T](oldDir: java.io.File, newDir: java.io.File)(action: (Git, Git) => T): T = {
val oldGit = Git.open(oldDir)
val newGit = Git.open(newDir)