mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(comment-content): use correct banExpiresAt path for ban visibility
This commit is contained in:
@@ -3,6 +3,7 @@ import { useLocation, useParams } from 'react-router-dom';
|
|||||||
import { Trans, useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
import { Comment } from '@plebbit/plebbit-react-hooks';
|
import { Comment } from '@plebbit/plebbit-react-hooks';
|
||||||
import useSubplebbitsPagesStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits-pages';
|
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 { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils';
|
||||||
import { isPostPageView } from '../../lib/utils/view-utils';
|
import { isPostPageView } from '../../lib/utils/view-utils';
|
||||||
import useIsMobile from '../../hooks/use-is-mobile';
|
import useIsMobile from '../../hooks/use-is-mobile';
|
||||||
@@ -22,9 +23,8 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
|
|||||||
const [showOriginal, setShowOriginal] = useState(false);
|
const [showOriginal, setShowOriginal] = useState(false);
|
||||||
const isMobile = useIsMobile();
|
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, subplebbitAddress } = post || {};
|
||||||
const { cid, content, deleted, edit, original, parentCid, postCid, pendingApproval, reason, removed, state } = post || {};
|
const banned = !!post?.author?.subplebbit?.banExpiresAt;
|
||||||
// const banned = !!post?.commentAuthor?.banExpiresAt;
|
|
||||||
|
|
||||||
const [showFullComment, setShowFullComment] = useState(false);
|
const [showFullComment, setShowFullComment] = useState(false);
|
||||||
const displayContent =
|
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 && (
|
|
||||||
<span className={styles.removedContent}>
|
<span className={styles.removedContent}>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@@ -123,12 +122,12 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
|
|||||||
children={`(${t('user_banned')})`}
|
children={`(${t('user_banned')})`}
|
||||||
content={`${t('ban_expires_at', {
|
content={`${t('ban_expires_at', {
|
||||||
address: subplebbitAddress && Plebbit.getShortAddress({ address: subplebbitAddress }),
|
address: subplebbitAddress && Plebbit.getShortAddress({ address: subplebbitAddress }),
|
||||||
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
|
timestamp: getFormattedDate(post?.author?.subplebbit?.banExpiresAt),
|
||||||
interpolation: { escapeValue: false },
|
interpolation: { escapeValue: false },
|
||||||
})}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`}
|
})}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
)} */}
|
)}
|
||||||
{!cid && state === 'pending' && stateString !== 'Failed' && (
|
{!cid && state === 'pending' && stateString !== 'Failed' && (
|
||||||
<>
|
<>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
Reference in New Issue
Block a user