From 5ef95846d871e62a1754f381f4ec446a4feedac4 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 9 Jul 2021 14:58:47 +0800 Subject: [PATCH] Add AUTO_EXPAND_REPLIES flag to toggle the feature. --- ui/component/comment/view.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/component/comment/view.jsx b/ui/component/comment/view.jsx index 9dbb20deb..19afc945d 100644 --- a/ui/component/comment/view.jsx +++ b/ui/component/comment/view.jsx @@ -24,6 +24,8 @@ import CommentMenuList from 'component/commentMenuList'; import UriIndicator from 'component/uriIndicator'; import CreditAmount from 'component/common/credit-amount'; +const AUTO_EXPAND_ALL_REPLIES = false; + type Props = { clearPlayingUri: () => void, uri: string, @@ -124,11 +126,12 @@ function Comment(props: Props) { // Auto-expand (limited to linked-comments for now, but can be for all) useEffect(() => { - if ( + const isInLinkedCommentChain = linkedCommentId && linkedCommentAncestors[linkedCommentId] && - linkedCommentAncestors[linkedCommentId].includes(commentId) - ) { + linkedCommentAncestors[linkedCommentId].includes(commentId); + + if (isInLinkedCommentChain || AUTO_EXPAND_ALL_REPLIES) { setShowReplies(true); setPage(1); }