mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-14 15:09:59 -04:00
Add totalReplyCount prop to check whether thread has reached limit instead of checking only the 20 we load on the first try
This commit is contained in:
parent
99344af688
commit
17ada7172d
2 changed files with 4 additions and 1 deletions
|
@ -103,13 +103,14 @@ class TopLevelComment extends React.Component {
|
|||
replies,
|
||||
postURI,
|
||||
threadHasReplyStatus,
|
||||
totalReplyCount,
|
||||
visibility
|
||||
} = this.props;
|
||||
|
||||
const parentVisible = visibility === 'visible';
|
||||
|
||||
// Check whether this comment thread has reached the thread limit
|
||||
const hasReachedThreadLimit = hasThreadLimit && replies.length >= THREAD_LIMIT;
|
||||
const hasReachedThreadLimit = hasThreadLimit && totalReplyCount >= THREAD_LIMIT;
|
||||
|
||||
/*
|
||||
Check all the following conditions:
|
||||
|
@ -250,6 +251,7 @@ TopLevelComment.propTypes = {
|
|||
postURI: PropTypes.string,
|
||||
replies: PropTypes.arrayOf(PropTypes.object),
|
||||
threadHasReplyStatus: PropTypes.bool,
|
||||
totalReplyCount: PropTypes.number,
|
||||
visibility: PropTypes.string
|
||||
};
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ const StudioComments = ({
|
|||
postURI={postURI}
|
||||
replies={replies && replies[comment.id] ? replies[comment.id] : []}
|
||||
threadHasReplyStatus={hasReplyStatus(comment)}
|
||||
totalReplyCount={comment.reply_count}
|
||||
visibility={comment.visibility}
|
||||
onAddComment={handleNewComment}
|
||||
onDelete={handleDeleteComment}
|
||||
|
|
Loading…
Reference in a new issue