Merge pull request #633 from Bnyro/comment-count

Add support for extracting the comment count
This commit is contained in:
Kavin 2023-06-26 11:07:03 +01:00 committed by GitHub
commit d4d0a40928
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -357,7 +357,7 @@ public class StreamHandlers {
nextpage = mapper.writeValueAsString(page); nextpage = mapper.writeValueAsString(page);
} }
CommentsPage commentsItem = new CommentsPage(comments, nextpage, info.isCommentsDisabled()); CommentsPage commentsItem = new CommentsPage(comments, nextpage, info.isCommentsDisabled(), info.getCommentsCount());
return mapper.writeValueAsBytes(commentsItem); return mapper.writeValueAsBytes(commentsItem);
@ -395,7 +395,7 @@ public class StreamHandlers {
nextpage = mapper.writeValueAsString(page); nextpage = mapper.writeValueAsString(page);
} }
CommentsPage commentsItem = new CommentsPage(comments, nextpage, false); CommentsPage commentsItem = new CommentsPage(comments, nextpage, false, -1);
return mapper.writeValueAsBytes(commentsItem); return mapper.writeValueAsBytes(commentsItem);

View file

@ -7,10 +7,12 @@ public class CommentsPage {
public List<Comment> comments; public List<Comment> comments;
public String nextpage; public String nextpage;
public boolean disabled; public boolean disabled;
public int commentCount;
public CommentsPage(List<Comment> comments, String nextpage, boolean disabled) { public CommentsPage(List<Comment> comments, String nextpage, boolean disabled, int commentCount) {
this.comments = comments; this.comments = comments;
this.nextpage = nextpage; this.nextpage = nextpage;
this.disabled = disabled; this.disabled = disabled;
this.commentCount = commentCount;
} }
} }