fix(post): 'comment too long' link was broken for description and rules

This commit is contained in:
Tom (plebeius.eth)
2024-08-01 14:40:07 +02:00
parent ba4906058d
commit 2ab71978a7
2 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -164,6 +164,7 @@ const ReplyBacklinks = ({ post }: PostProps) => {
const PostMessageMobile = ({ post }: PostProps) => {
const { t } = useTranslation();
const { cid, content, deleted, edit, original, parentCid, postCid, reason, removed, state, subplebbitAddress } = post || {};
const { isDescription, isRules } = post || {}; // custom properties, not from api
// TODO: commentAuthor is not available outside of editedComment, update when available
// const banned = !!post?.commentAuthor?.banExpiresAt;
const [showOriginal, setShowOriginal] = useState(false);
@@ -244,7 +245,11 @@ const PostMessageMobile = ({ post }: PostProps) => {
{!isReply && content.length > 1000 && !isInPostView && (
<span className={styles.abbr}>
<br />
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <Link to={`/p/${subplebbitAddress}/c/${cid}`} /> }} />
<Trans
i18nKey={'comment_too_long'}
shouldUnescape={true}
components={{ 1: <Link to={`/p/${subplebbitAddress}/${isDescription ? 'description' : isRules ? 'rules' : `c/${cid}`}`} /> }}
/>
</span>
)}
{!cid && state === 'pending' && stateString !== 'Failed' && (