|
23 | 23 | */ |
24 | 24 | package org.kohsuke.github; |
25 | 25 |
|
26 | | -import com.gargoylesoftware.htmlunit.WebClient; |
27 | | -import com.gargoylesoftware.htmlunit.html.HtmlButton; |
28 | | -import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput; |
29 | | -import com.gargoylesoftware.htmlunit.html.HtmlForm; |
30 | | -import com.gargoylesoftware.htmlunit.html.HtmlInput; |
31 | | -import com.gargoylesoftware.htmlunit.html.HtmlPage; |
32 | 26 | import com.infradna.tool.bridge_method_injector.WithBridgeMethods; |
33 | 27 |
|
34 | 28 | import java.io.IOException; |
@@ -266,15 +260,10 @@ private void modifyCollaborators(Collection<GHUser> users, String method) throws |
266 | 260 | } |
267 | 261 |
|
268 | 262 | public void setEmailServiceHook(String address) throws IOException { |
269 | | - WebClient wc = root.createWebClient(); |
270 | | - HtmlPage pg = (HtmlPage)wc.getPage(getUrl()+"/admin"); |
271 | | - HtmlInput email = (HtmlInput)pg.getElementById("email_address"); |
272 | | - email.setValueAttribute(address); |
273 | | - HtmlCheckBoxInput active = (HtmlCheckBoxInput)pg.getElementById("email[active]"); |
274 | | - active.setChecked(true); |
275 | | - |
276 | | - final HtmlForm f = email.getEnclosingFormOrDie(); |
277 | | - f.submit((HtmlButton) f.getElementsByTagName("button").get(0)); |
| 263 | + Map<String, String> config = new HashMap<String, String>(); |
| 264 | + config.put("address", address); |
| 265 | + new Requester(root).method("POST").with("name", "email").with("config", config).with("active", "true") |
| 266 | + .to(String.format("/repos/%s/%s/hooks", owner.login, name)); |
278 | 267 | } |
279 | 268 |
|
280 | 269 | private void edit(String key, String value) throws IOException { |
|
0 commit comments