From 476681c689edba6fe0dbc052c9908649188cca60 Mon Sep 17 00:00:00 2001 From: plebeius Date: Fri, 9 Jan 2026 16:28:17 +0100 Subject: [PATCH] fix(comment-content): use correct banExpiresAt path for ban visibility --- src/components/comment-content/comment-content.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/comment-content/comment-content.tsx b/src/components/comment-content/comment-content.tsx index a6d55a07..e5a0cd8a 100644 --- a/src/components/comment-content/comment-content.tsx +++ b/src/components/comment-content/comment-content.tsx @@ -3,6 +3,7 @@ import { useLocation, useParams } from 'react-router-dom'; import { Trans, useTranslation } from 'react-i18next'; import { Comment } from '@plebbit/plebbit-react-hooks'; import useSubplebbitsPagesStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits-pages'; +import Plebbit from '@plebbit/plebbit-js'; import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils'; import { isPostPageView } from '../../lib/utils/view-utils'; import useIsMobile from '../../hooks/use-is-mobile'; @@ -22,9 +23,8 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => { const [showOriginal, setShowOriginal] = useState(false); const isMobile = useIsMobile(); - // TODO: commentAuthor is not yet available outside of editedComment, wait for API to be updated - const { cid, content, deleted, edit, original, parentCid, postCid, pendingApproval, reason, removed, state } = post || {}; - // const banned = !!post?.commentAuthor?.banExpiresAt; + const { cid, content, deleted, edit, original, parentCid, postCid, pendingApproval, reason, removed, state, subplebbitAddress } = post || {}; + const banned = !!post?.author?.subplebbit?.banExpiresAt; const [showFullComment, setShowFullComment] = useState(false); const displayContent = @@ -114,8 +114,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => { )} )} - {/* TODO: commentAuthor is not yet available outside of editedComment, wait for API to be updated */} - {/* {banned && ( + {banned && (

@@ -123,12 +122,12 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => { children={`(${t('user_banned')})`} content={`${t('ban_expires_at', { address: subplebbitAddress && Plebbit.getShortAddress({ address: subplebbitAddress }), - timestamp: getFormattedDate(commentAuthor?.banExpiresAt), + timestamp: getFormattedDate(post?.author?.subplebbit?.banExpiresAt), interpolation: { escapeValue: false }, })}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`} />
- )} */} + )} {!cid && state === 'pending' && stateString !== 'Failed' && ( <>