mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-29 22:07:46 +03:00
updating parent comment replies count if deeper replies are added
This commit is contained in:
parent
b0fbedcb82
commit
7ca3345ed6
@ -39,6 +39,7 @@ const CommentView = ({
|
||||
hideManyCommentsButton,
|
||||
openReplyThread,
|
||||
fetchedAt,
|
||||
incrementRepliesCount
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
const actionSheet = useRef(null);
|
||||
@ -77,6 +78,9 @@ const CommentView = ({
|
||||
//TODO: update comment count and show sub comment if required;
|
||||
const cachedComment = cachedComments.get(postPath);
|
||||
if(cachedComment.updated === cachedComment.created){
|
||||
if(commentNumber > 1 && incrementRepliesCount){
|
||||
incrementRepliesCount();
|
||||
}
|
||||
setChildCount(childCount + 1);
|
||||
setReplies(replies ? [...replies, cachedComment] : [cachedComment]);
|
||||
}
|
||||
@ -102,6 +106,13 @@ const CommentView = ({
|
||||
setCacheVoteIcrement(1);
|
||||
};
|
||||
|
||||
const _incrementRepliesCount = () => {
|
||||
if(commentNumber > 1 && incrementRepliesCount){
|
||||
incrementRepliesCount();
|
||||
}
|
||||
setChildCount(childCount + 1);
|
||||
}
|
||||
|
||||
|
||||
const _renderReadMoreButton = () => (
|
||||
<TextWithIcon
|
||||
@ -139,6 +150,7 @@ const CommentView = ({
|
||||
hideManyCommentsButton={hideManyCommentsButton}
|
||||
mainAuthor={mainAuthor}
|
||||
fetchedAt={fetchedAt}
|
||||
incrementRepliesCount={_incrementRepliesCount}
|
||||
/>
|
||||
</AnimatedView>
|
||||
|
||||
|
@ -46,6 +46,7 @@ const CommentsContainer = ({
|
||||
hideManyCommentsButton,
|
||||
flatListProps,
|
||||
fetchedAt,
|
||||
incrementRepliesCount,
|
||||
}) => {
|
||||
const lastCacheUpdate = useAppSelector((state) => state.cache.lastUpdate);
|
||||
const cachedComments = useAppSelector((state) => state.cache.comments);
|
||||
@ -345,6 +346,7 @@ const CommentsContainer = ({
|
||||
showAllComments={showAllComments}
|
||||
flatListProps={flatListProps}
|
||||
openReplyThread={_openReplyThread}
|
||||
incrementRepliesCount={incrementRepliesCount}
|
||||
fetchedAt={fetchedAt}
|
||||
/>
|
||||
);
|
||||
|
@ -36,6 +36,7 @@ const CommentsView = ({
|
||||
flatListProps,
|
||||
openReplyThread,
|
||||
fetchedAt,
|
||||
incrementRepliesCount
|
||||
}) => {
|
||||
const [selectedComment, setSelectedComment] = useState(null);
|
||||
const intl = useIntl();
|
||||
@ -112,6 +113,7 @@ const CommentsView = ({
|
||||
handleOnLongPress={() => _openCommentMenu(item)}
|
||||
openReplyThread={()=> _openReplyThread(item)}
|
||||
fetchedAt={fetchedAt}
|
||||
incrementRepliesCount={incrementRepliesCount}
|
||||
/>
|
||||
)
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user