disabled mock content

This commit is contained in:
plebbitor
2023-04-15 18:12:46 +02:00
parent 71fd9adf7c
commit 9d4d989068
6 changed files with 21 additions and 24 deletions
+6 -6
View File
@@ -4,12 +4,12 @@ const getCommentMediaInfo = (comment) => {
if (!comment?.thumbnailUrl && !comment?.link) {
return;
}
if (comment?.thumbnailUrl) {
return {
url: comment.link,
type: 'webpage'
};
}
// if (comment?.thumbnailUrl) {
// return {
// url: comment.link,
// type: 'webpage'
// };
// }
if (comment?.link) {
try {
new URL(comment.link);
+3 -3
View File
@@ -3,7 +3,7 @@ function renderComments(comments) {
let omittedCount = 0;
const renderComment = (comment) => {
const { replyCount, replies: { pages: { topAll: { comments: nestedComments } } } } = comment;
const { replyCount, replies: { pages: { topAll: { comments: nestedComments = [] } = {} } = {} } = {} } = comment;
let renderedNestedComments = [];
if (replyCount > 0 && nestedComments.length > 0) {
@@ -21,8 +21,8 @@ function renderComments(comments) {
return displayedComments;
};
const renderedComments = comments.flatMap(renderComment);
renderedComments.sort((a, b) => a.timestamp - b.timestamp);
const renderedComments = comments?.flatMap(renderComment);
renderedComments?.sort((a, b) => a.timestamp - b.timestamp);
return { renderedComments, omittedCount };
}
+1 -1
View File
@@ -2,7 +2,7 @@ function renderThreadComments(comments) {
const commentKeys = Object.keys(comments);
const renderedComments = commentKeys.map(key => {
const comment = comments[key];
const { replies: { pages: { topAll: { comments: nestedComments } } } } = comment;
const { replies: { pages: { topAll: { comments: nestedComments = [] } = {} } = {} } = {} } = comment;
if (comment.replyCount > 0 && nestedComments) {
const renderedNestedComments = renderThreadComments(nestedComments);
return [comment, ...renderedNestedComments];