mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): don't show link if comment is removed or deleted
This commit is contained in:
@@ -376,7 +376,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
|
|||||||
post = editedComment;
|
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 isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`);
|
||||||
const { hidden } = useHide({ cid });
|
const { hidden } = useHide({ cid });
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
|
|||||||
data-post-cid={postCid}
|
data-post-cid={postCid}
|
||||||
>
|
>
|
||||||
<PostInfo openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} />
|
<PostInfo openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} />
|
||||||
{link && !hidden && isValidURL(link) && <PostMedia post={post} />}
|
{link && !hidden && !(deleted || removed) && isValidURL(link) && <PostMedia post={post} />}
|
||||||
{!hidden && <PostMessage post={post} />}
|
{!hidden && <PostMessage post={post} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -399,7 +399,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
|
|||||||
|
|
||||||
const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies = true }: PostProps) => {
|
const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies = true }: PostProps) => {
|
||||||
const { t } = useTranslation();
|
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 { isDescription, isRules } = post || {}; // custom properties, not from api
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@@ -445,7 +445,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<div data-cid={cid} data-author-address={author?.shortAddress} data-post-cid={postCid}>
|
<div data-cid={cid} data-author-address={author?.shortAddress} data-post-cid={postCid}>
|
||||||
{link && !isHidden && isValidURL(link) && <PostMedia post={post} />}
|
{link && !isHidden && !(deleted || removed) && isValidURL(link) && <PostMedia post={post} />}
|
||||||
<PostInfo isHidden={isHidden} openReplyModal={openReplyModal} post={post} postReplyCount={replyCount} roles={roles} />
|
<PostInfo isHidden={isHidden} openReplyModal={openReplyModal} post={post} postReplyCount={replyCount} roles={roles} />
|
||||||
{!isHidden && !content && <div className={styles.spacer} />}
|
{!isHidden && !content && <div className={styles.spacer} />}
|
||||||
{!isHidden && content && <PostMessage post={post} />}
|
{!isHidden && content && <PostMessage post={post} />}
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{(hasThumbnail || link) && <CommentMedia commentMediaInfo={commentMediaInfo} post={post} showThumbnail={showThumbnail} setShowThumbnail={setShowThumbnail} />}
|
{(hasThumbnail || link) && !(deleted || removed) && (
|
||||||
|
<CommentMedia commentMediaInfo={commentMediaInfo} post={post} showThumbnail={showThumbnail} setShowThumbnail={setShowThumbnail} />
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user