mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Fix NPE and add comments disabled field.
This commit is contained in:
parent
3bc9d05fc4
commit
9d09232319
2 changed files with 7 additions and 5 deletions
|
@ -477,8 +477,8 @@ public class ResponseHelper {
|
|||
info.getRelatedItems().forEach(comment -> {
|
||||
comments.add(new Comment(comment.getUploaderName(), rewriteURL(comment.getUploaderAvatarUrl()),
|
||||
comment.getCommentId(), comment.getCommentText(), comment.getTextualUploadDate(),
|
||||
comment.getUploaderUrl().substring(19), comment.getLikeCount(), comment.isHeartedByUploader(),
|
||||
comment.isPinned(), comment.isUploaderVerified()));
|
||||
optionalSubstring(comment.getUploaderUrl(), 19), comment.getLikeCount(),
|
||||
comment.isHeartedByUploader(), comment.isPinned(), comment.isUploaderVerified()));
|
||||
});
|
||||
|
||||
String nextpage = null;
|
||||
|
@ -487,7 +487,7 @@ public class ResponseHelper {
|
|||
nextpage = Constants.mapper.writeValueAsString(page);
|
||||
}
|
||||
|
||||
CommentsPage commentsItem = new CommentsPage(comments, nextpage);
|
||||
CommentsPage commentsItem = new CommentsPage(comments, nextpage, info.isCommentsDisabled());
|
||||
|
||||
return Constants.mapper.writeValueAsBytes(commentsItem);
|
||||
|
||||
|
@ -516,7 +516,7 @@ public class ResponseHelper {
|
|||
nextpage = Constants.mapper.writeValueAsString(page);
|
||||
}
|
||||
|
||||
CommentsPage commentsItem = new CommentsPage(comments, nextpage);
|
||||
CommentsPage commentsItem = new CommentsPage(comments, nextpage, init.isCommentsDisabled());
|
||||
|
||||
return Constants.mapper.writeValueAsBytes(commentsItem);
|
||||
|
||||
|
|
|
@ -6,9 +6,11 @@ public class CommentsPage {
|
|||
|
||||
public List<Comment> comments;
|
||||
public String nextpage;
|
||||
public boolean disabled;
|
||||
|
||||
public CommentsPage(List<Comment> comments, String nextpage) {
|
||||
public CommentsPage(List<Comment> comments, String nextpage, boolean disabled) {
|
||||
this.comments = comments;
|
||||
this.nextpage = nextpage;
|
||||
this.disabled = disabled;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue