Skip to content

Commit 1419327

Browse files
ExtendedCommitComment.java
- now extends CommitComment, yay - but they are still missing a few things.. README.md - updated, seems line is now removed from commit comments
1 parent 43adccb commit 1419327

File tree

3 files changed

+40
-57
lines changed

3 files changed

+40
-57
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,19 +335,22 @@ updatedAt | `Date` | false
335335
### Properties
336336
Name | Type | Setter | Description
337337
-----|------|----------|------------
338-
id | `Integer` | false
338+
id | `Long` | false
339339
url | `String` | false
340340
user | `String` | false
341341
createdAt | `Date` | false
342342
updatedAt | `Date` | false
343343
commitId | `String` | false
344-
originalCommitId | `Integer` | false
344+
originalCommitId | `Long` | false
345345
body | `String` | **true**
346346
path | `String` | false
347-
line | `Integer` | false
347+
line | `Integer` | false | This will always return `null` as the GitHub APIs no longer return `line`, use `position` instead.
348348
position | `Integer` | false
349349
originalPosition | `Integer` | false
350350
diffHunk | `String` | false
351+
pullRequestUrl | `String` | false
352+
pullRequestReviewId | `Long` | false
353+
inReplyToId | `Long` | false
351354

352355
### Methods
353356
> void delete()
@@ -531,7 +534,7 @@ for (comment in pullRequest.comments) {
531534
### Listing a Pull Request's review comments
532535
```groovy
533536
for (reviewComment in pullRequest.reviewComments) {
534-
echo "File: ${reviewComment.path}, Line: ${reviewComment.line}, Author: ${reviewComment.user}, Comment: ${reviewComment.body}"
537+
echo "File: ${reviewComment.path}, Position: ${reviewComment.position}, Author: ${reviewComment.user}, Comment: ${reviewComment.body}"
535538
}
536539
```
537540

src/main/java/org/jenkinsci/plugins/pipeline/github/ReviewCommentGroovyObject.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class ReviewCommentGroovyObject extends GroovyObjectSupport implements Se
4343
}
4444

4545
@Whitelisted
46+
@Deprecated
4647
public Integer getLine() {
4748
return commitComment.getLine();
4849
}
@@ -107,6 +108,21 @@ public String getUser() {
107108
return GitHubHelper.userToLogin(commitComment.getUser());
108109
}
109110

111+
@Whitelisted
112+
public long getInReplyToId() {
113+
return commitComment.getInReplyToId();
114+
}
115+
116+
@Whitelisted
117+
public String getPullRequestUrl() {
118+
return commitComment.getPullRequestUrl();
119+
}
120+
121+
@Whitelisted
122+
public long getPullRequestReviewId() {
123+
return commitComment.getPullRequestReviewId();
124+
}
125+
110126
@Whitelisted
111127
public void setBody(final String body) {
112128
Objects.requireNonNull(body, "body cannot be null");
Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,38 @@
11
package org.jenkinsci.plugins.pipeline.github.client;
22

3-
import org.eclipse.egit.github.core.Comment;
3+
import org.eclipse.egit.github.core.CommitComment;
44

55
/**
66
* @author Aaron Whiteside
77
*/
8-
public class ExtendedCommitComment extends Comment {
8+
public class ExtendedCommitComment extends CommitComment {
99
private static final long serialVersionUID = 4834285683963788350L;
1010

11-
private Integer line;
12-
private Integer position;
13-
private Integer originalPosition;
14-
private String commitId;
15-
private String originalCommitId;
16-
private String path;
17-
private String diffHunk;
11+
private String pullRequestUrl;
12+
private long pullRequestReviewId;
13+
private long inReplyToId;
1814

19-
public Integer getLine() {
20-
return line;
15+
public long getInReplyToId() {
16+
return inReplyToId;
2117
}
2218

23-
public void setLine(final Integer line) {
24-
this.line = line;
19+
public void setInReplyToId(final long inReplyToId) {
20+
this.inReplyToId = inReplyToId;
2521
}
2622

27-
public Integer getPosition() {
28-
return position;
23+
public String getPullRequestUrl() {
24+
return pullRequestUrl;
2925
}
3026

31-
public void setPosition(final Integer position) {
32-
this.position = position;
27+
public void setPullRequestUrl(final String pullRequestUrl) {
28+
this.pullRequestUrl = pullRequestUrl;
3329
}
3430

35-
public Integer getOriginalPosition() {
36-
return originalPosition;
31+
public long getPullRequestReviewId() {
32+
return pullRequestReviewId;
3733
}
3834

39-
public void setOriginalPosition(final Integer originalPosition) {
40-
this.originalPosition = originalPosition;
41-
}
42-
43-
public String getCommitId() {
44-
return commitId;
45-
}
46-
47-
public void setCommitId(final String commitId) {
48-
this.commitId = commitId;
49-
}
50-
51-
public String getOriginalCommitId() {
52-
return originalCommitId;
53-
}
54-
55-
public void setOriginalCommitId(final String originalCommitId) {
56-
this.originalCommitId = originalCommitId;
57-
}
58-
59-
public String getPath() {
60-
return path;
61-
}
62-
63-
public void setPath(final String path) {
64-
this.path = path;
65-
}
66-
67-
public String getDiffHunk() {
68-
return diffHunk;
69-
}
70-
71-
public void setDiffHunk(final String diffHunk) {
72-
this.diffHunk = diffHunk;
35+
public void setPullRequestReviewId(long pullRequestReviewId) {
36+
this.pullRequestReviewId = pullRequestReviewId;
7337
}
7438
}

0 commit comments

Comments
 (0)