From 068c30a3222877c816b22601920c0d03a18b7c18 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Thu, 29 Aug 2024 12:47:22 +0200 Subject: [PATCH] fix(post): don't show link if comment is removed or deleted --- src/components/post-desktop/post-desktop.tsx | 8 ++++---- src/components/post-mobile/post-mobile.tsx | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx index ff75da19..633b1902 100644 --- a/src/components/post-desktop/post-desktop.tsx +++ b/src/components/post-desktop/post-desktop.tsx @@ -376,7 +376,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => { post = editedComment; } - const { author, cid, link, postCid, subplebbitAddress } = post || {}; + const { author, cid, deleted, link, postCid, removed, subplebbitAddress } = post || {}; const isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`); const { hidden } = useHide({ cid }); @@ -390,7 +390,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => { data-post-cid={postCid} > - {link && !hidden && isValidURL(link) && } + {link && !hidden && !(deleted || removed) && isValidURL(link) && } {!hidden && } @@ -399,7 +399,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => { const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies = true }: PostProps) => { const { t } = useTranslation(); - const { author, cid, content, link, pinned, postCid, state, subplebbitAddress } = post || {}; + const { author, cid, content, deleted, link, pinned, postCid, removed, state, subplebbitAddress } = post || {}; const { isDescription, isRules } = post || {}; // custom properties, not from api const params = useParams(); const location = useLocation(); @@ -445,7 +445,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies )}
- {link && !isHidden && isValidURL(link) && } + {link && !isHidden && !(deleted || removed) && isValidURL(link) && } {!isHidden && !content &&
} {!isHidden && content && } diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index d4b4737b..fa5ff617 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -162,7 +162,9 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P )}
- {(hasThumbnail || link) && } + {(hasThumbnail || link) && !(deleted || removed) && ( + + )} ); };