add action link to pull request.

This commit is contained in:
nazoking
2015-01-30 00:30:11 +09:00
parent 0acbaeae86
commit 5f5cc8d454
5 changed files with 103 additions and 67 deletions

View File

@@ -81,6 +81,25 @@ trait PullRequestService { self: IssuesService =>
.map { case (t1, t2) => t1 }
.list
def getPullRequestByRequestCommit(userName: String, repositoryName: String, toBranch:String, fromBranch: String, commitId: String)
(implicit s: Session): Option[(PullRequest, Issue)] = {
if(toBranch == fromBranch){
None
} else {
PullRequests
.innerJoin(Issues).on { (t1, t2) => t1.byPrimaryKey(t2.userName, t2.repositoryName, t2.issueId) }
.filter { case (t1, t2) =>
(t1.userName === userName.bind) &&
(t1.repositoryName === repositoryName.bind) &&
(t1.branch === toBranch.bind) &&
(t1.requestUserName === userName.bind) &&
(t1.requestRepositoryName === repositoryName.bind) &&
(t1.requestBranch === fromBranch.bind) &&
(t1.commitIdTo === commitId.bind)
}
.firstOption
}
}
}
object PullRequestService {