mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): don't show replies in pending post page
This commit is contained in:
@@ -5,7 +5,7 @@ import { Role, useAccount, useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
|||||||
import Plebbit from '@plebbit/plebbit-js/dist/browser/index.js';
|
import Plebbit from '@plebbit/plebbit-js/dist/browser/index.js';
|
||||||
import { getCommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-utils';
|
import { getCommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-utils';
|
||||||
import { getFormattedDate } from '../../lib/utils/time-utils';
|
import { getFormattedDate } from '../../lib/utils/time-utils';
|
||||||
import { isPostPageView } from '../../lib/utils/view-utils';
|
import { isPendingPostView, isPostPageView } from '../../lib/utils/view-utils';
|
||||||
import useCountLinksInReplies from '../../hooks/use-count-links-in-replies';
|
import useCountLinksInReplies from '../../hooks/use-count-links-in-replies';
|
||||||
import useReplies from '../../hooks/use-replies';
|
import useReplies from '../../hooks/use-replies';
|
||||||
import useStateString from '../../hooks/use-state-string';
|
import useStateString from '../../hooks/use-state-string';
|
||||||
@@ -39,6 +39,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isInPostPage = isPostPageView(location.pathname, params);
|
const isInPostPage = isPostPageView(location.pathname, params);
|
||||||
|
const isPendingPostPage = isPendingPostView(location.pathname, params);
|
||||||
|
|
||||||
const displayTitle = title && title.length > 75 ? title?.slice(0, 75) + '...' : title;
|
const displayTitle = title && title.length > 75 ? title?.slice(0, 75) + '...' : title;
|
||||||
const displayContent = content && !isInPostPage && content.length > 1000 ? content?.slice(0, 1000) + '(...)' : content;
|
const displayContent = content && !isInPostPage && content.length > 1000 ? content?.slice(0, 1000) + '(...)' : content;
|
||||||
@@ -212,6 +213,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{!(pinned && !isInPostPage) &&
|
{!(pinned && !isInPostPage) &&
|
||||||
|
!isPendingPostPage &&
|
||||||
!isDescription &&
|
!isDescription &&
|
||||||
!isRules &&
|
!isRules &&
|
||||||
replies &&
|
replies &&
|
||||||
@@ -373,6 +375,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isInPostPage = isPostPageView(location.pathname, params);
|
const isInPostPage = isPostPageView(location.pathname, params);
|
||||||
|
const isPendingPostPage = isPendingPostView(location.pathname, params);
|
||||||
|
|
||||||
const linksCount = useCountLinksInReplies(post);
|
const linksCount = useCountLinksInReplies(post);
|
||||||
const displayTitle = title && title.length > 30 ? title?.slice(0, 30) + '(...)' : title;
|
const displayTitle = title && title.length > 30 ? title?.slice(0, 30) + '(...)' : title;
|
||||||
@@ -488,6 +491,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!(pinned && !isInPostPage) &&
|
{!(pinned && !isInPostPage) &&
|
||||||
|
!isPendingPostPage &&
|
||||||
!isDescription &&
|
!isDescription &&
|
||||||
!isRules &&
|
!isRules &&
|
||||||
replies &&
|
replies &&
|
||||||
|
|||||||
Reference in New Issue
Block a user