(refs #196)Fire WebHook in merging pull request from Web GUI.

This commit is contained in:
takezoe
2013-12-12 04:23:43 +09:00
parent a4cb5c991c
commit ac884bd7c3

View File

@@ -18,13 +18,14 @@ import util.JGitUtil.CommitInfo
import org.slf4j.LoggerFactory
import org.eclipse.jgit.merge.MergeStrategy
import org.eclipse.jgit.errors.NoMergeBaseException
import service.WebHookService.WebHookPayload
class PullRequestsController extends PullRequestsControllerBase
with RepositoryService with AccountService with IssuesService with PullRequestService with MilestonesService with ActivityService
with RepositoryService with AccountService with IssuesService with PullRequestService with MilestonesService with ActivityService with WebHookService
with ReferrerAuthenticator with CollaboratorsAuthenticator
trait PullRequestsControllerBase extends ControllerBase {
self: RepositoryService with AccountService with IssuesService with MilestonesService with ActivityService with PullRequestService
self: RepositoryService with AccountService with IssuesService with MilestonesService with ActivityService with PullRequestService with WebHookService
with ReferrerAuthenticator with CollaboratorsAuthenticator =>
private val logger = LoggerFactory.getLogger(classOf[PullRequestsControllerBase])
@@ -163,6 +164,20 @@ trait PullRequestsControllerBase extends ControllerBase {
}
}
// call web hook
val webHookURLs = getWebHookURLs(owner, name)
if(webHookURLs.nonEmpty){
val payload = WebHookPayload(
git,
loginAccount,
mergeBaseRefName,
repository,
commits.flatten.toList,
getAccountByUserName(owner).get)
callWebHook(owner, name, webHookURLs, payload)
}
// notifications
Notifier().toNotify(repository, issueId, "merge"){
Notifier.msgStatus(s"${baseUrl}/${owner}/${name}/pull/${issueId}")