call web hook on issue or pull_request both opened or closed. and issue_comment.

This commit is contained in:
nazoking
2015-01-08 15:09:21 +09:00
parent b512e7c390
commit 321a3a72f0
7 changed files with 260 additions and 106 deletions

View File

@@ -17,7 +17,7 @@ import org.eclipse.jgit.treewalk._
import jp.sf.amateras.scalatra.forms._
import org.eclipse.jgit.dircache.DirCache
import org.eclipse.jgit.revwalk.RevCommit
import service.WebHookService.WebHookPayload
import service.WebHookService.WebHookPushPayload
class RepositoryViewerController extends RepositoryViewerControllerBase
with RepositoryService with AccountService with ActivityService with IssuesService with WebHookService with CommitsService
@@ -504,13 +504,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
// call web hook
val commit = new JGitUtil.CommitInfo(JGitUtil.getRevCommitFromId(git, commitId))
getWebHookURLs(repository.owner, repository.name) match {
case webHookURLs if(webHookURLs.nonEmpty) =>
for(ownerAccount <- getAccountByUserName(repository.owner)){
callWebHook("push", webHookURLs,
WebHookPayload(git, loginAccount, headName, repository, List(commit), ownerAccount))
}
case _ =>
callWebHookOf(repository.owner, repository.name, "push") {
getAccountByUserName(repository.owner).map{ ownerAccount =>
WebHookPushPayload(git, loginAccount, headName, repository, List(commit), ownerAccount)
}
}
}
}