Skip to content

Commit

Permalink
Merge pull request #37 from spiffxp/pr-comments-fix
Browse files Browse the repository at this point in the history
Force issues-based API route for PR comments
  • Loading branch information
kohsuke committed May 6, 2013
2 parents 367a5f0 + 5410ba3 commit fab9687
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/org/kohsuke/github/GHIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public URL getApiURL(){
* Updates the issue by adding a comment.
*/
public void comment(String message) throws IOException {
new Requester(root).with("body",message).to(getApiRoute() + "/comments");
new Requester(root).with("body",message).to(getIssuesApiRoute() + "/comments");
}

private void edit(String key, Object value) throws IOException {
Expand Down Expand Up @@ -190,7 +190,7 @@ public List<GHIssueComment> getComments() throws IOException {
public PagedIterable<GHIssueComment> listComments() throws IOException {
return new PagedIterable<GHIssueComment>() {
public PagedIterator<GHIssueComment> iterator() {
return new PagedIterator<GHIssueComment>(root.retrieve().asIterator(getApiRoute() + "/comments", GHIssueComment[].class)) {
return new PagedIterator<GHIssueComment>(root.retrieve().asIterator(getIssuesApiRoute() + "/comments", GHIssueComment[].class)) {
protected void wrapUp(GHIssueComment[] page) {
for (GHIssueComment c : page)
c.wrapUp(GHIssue.this);
Expand All @@ -201,6 +201,10 @@ protected void wrapUp(GHIssueComment[] page) {
}

protected String getApiRoute() {
return getIssuesApiRoute();
}

private String getIssuesApiRoute() {
return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/issues/"+number;
}

Expand Down Expand Up @@ -250,4 +254,4 @@ public URL getUrl() {
return GitHub.parseURL(html_url);
}
}
}
}

0 comments on commit fab9687

Please sign in to comment.