mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 23:57:55 -05:00
Revert "Only request replies if reply_count > 0"
This commit is contained in:
parent
b3795c943f
commit
10f887f8ba
2 changed files with 5 additions and 14 deletions
|
@ -69,10 +69,8 @@ const getTopLevelComments = (id, offset, ownerUsername, isAdmin, token) => (disp
|
|||
}
|
||||
dispatch(setFetchStatus('comments', Status.FETCHED));
|
||||
dispatch(setComments(body));
|
||||
const commentsWithReplies = body.filter(comment => comment.reply_count > 0);
|
||||
if (commentsWithReplies.length > 0) {
|
||||
dispatch(getReplies(id, commentsWithReplies.map(comment => comment.id), 0, ownerUsername, isAdmin, token));
|
||||
}
|
||||
dispatch(getReplies(id, body.map(comment => comment.id), 0, ownerUsername, isAdmin, token));
|
||||
|
||||
// If we loaded a full page of comments, assume there are more to load.
|
||||
// This will be wrong (1 / COMMENT_LIMIT) of the time, but does not require
|
||||
// any more server query complexity, so seems worth it. In the case of a project with
|
||||
|
@ -107,9 +105,7 @@ const getCommentById = (projectId, commentId, ownerUsername, isAdmin, token) =>
|
|||
// If the comment is not a reply, show it as top level and load replies
|
||||
dispatch(setFetchStatus('comments', Status.FETCHED));
|
||||
dispatch(setComments([body]));
|
||||
if (body.reply_count > 0) {
|
||||
dispatch(getReplies(projectId, [body.id], 0, ownerUsername, isAdmin, token));
|
||||
}
|
||||
dispatch(getReplies(projectId, [body.id], 0, ownerUsername, isAdmin, token));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -90,10 +90,7 @@ const getTopLevelComments = () => ((dispatch, getState) => {
|
|||
}
|
||||
dispatch(setFetchStatus('comments', Status.FETCHED));
|
||||
dispatch(setComments(body));
|
||||
const commentsWithReplies = body.filter(comment => comment.reply_count > 0);
|
||||
if (commentsWithReplies.length > 0) {
|
||||
dispatch(getReplies(commentsWithReplies.map(comment => comment.id), 0));
|
||||
}
|
||||
dispatch(getReplies(body.map(comment => comment.id), 0));
|
||||
|
||||
// If we loaded a full page of comments, assume there are more to load.
|
||||
// This will be wrong (1 / COMMENT_LIMIT) of the time, but does not require
|
||||
|
@ -133,9 +130,7 @@ const getCommentById = commentId => ((dispatch, getState) => {
|
|||
// If the comment is not a reply, show it as top level and load replies
|
||||
dispatch(setFetchStatus('comments', Status.FETCHED));
|
||||
dispatch(setComments([body]));
|
||||
if (body.reply_count > 0) {
|
||||
dispatch(getReplies(body.id, 0));
|
||||
}
|
||||
dispatch(getReplies(body.id, 0));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue