+ });
+ $this->github->drain();
+ }
+
+ function delHook($owner, $repo) {
+ $this->github->readRepo("$owner/$repo")->then(function($result) {
+ list($repo) = $result;
+ $call = new ListHooks($this->github, ["repo" => $repo->full_name]);
+ $this->github->queue($call)->then(function($result) use($repo, $call) {
+ list($repo->hooks) = $result;
+ if (($hook = $this->github->checkRepoHook($repo))) {
+ $this->github->deleteRepoHook($repo->full_name, $hook->id)->then(function() use($repo, $call) {
+ $call->dropFromCache();
+ $this->redirectBack($repo->full_name);
+ });
+ }
+ });
+ });
+ $this->github->drain();
+ }
+
+ function redirectBack($repo) {
+ if (($back = $this->app->getRequest()->getForm("returnback")) && isset($this->session->previous)) {
+ $this->app->redirect($this->app->getBaseUrl()->mod($this->session->previous));
+ } else {
+ $this->app->redirect($this->app->getBaseUrl()->mod("./github/repo/" . $repo));
+ }