mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): content could bypass max character count if posted from other plebbit client
This commit is contained in:
@@ -296,7 +296,13 @@ const PostMessage = ({ post }: PostProps) => {
|
|||||||
const [showOriginal, setShowOriginal] = useState(false);
|
const [showOriginal, setShowOriginal] = useState(false);
|
||||||
|
|
||||||
const [showFullComment, setShowFullComment] = useState(false);
|
const [showFullComment, setShowFullComment] = useState(false);
|
||||||
const displayContent = content && !isInPostView && content.length > 1000 && !showFullComment ? content.slice(0, 1000) : content;
|
const displayContent =
|
||||||
|
content &&
|
||||||
|
(!isInPostView && content.length > 1000 && !showFullComment
|
||||||
|
? content.slice(0, 1000)
|
||||||
|
: isInPostView && content.length > 2000 && !showFullComment
|
||||||
|
? content.slice(0, 2000)
|
||||||
|
: content);
|
||||||
|
|
||||||
const quotelinkReply = useComment({ commentCid: parentCid });
|
const quotelinkReply = useComment({ commentCid: parentCid });
|
||||||
const isReply = parentCid;
|
const isReply = parentCid;
|
||||||
@@ -377,7 +383,7 @@ const PostMessage = ({ post }: PostProps) => {
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
)} */}
|
)} */}
|
||||||
{content?.length > 1000 && !isInPostView && !showFullComment && (
|
{((!isInPostView && content?.length > 1000 && !showFullComment) || (isInPostView && content?.length > 2000 && !showFullComment)) && (
|
||||||
<span className={styles.abbr}>
|
<span className={styles.abbr}>
|
||||||
<br />
|
<br />
|
||||||
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <span onClick={() => setShowFullComment(true)} /> }} />
|
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <span onClick={() => setShowFullComment(true)} /> }} />
|
||||||
|
|||||||
@@ -227,7 +227,13 @@ const PostMessageMobile = ({ post }: PostProps) => {
|
|||||||
const isInPostView = isPostPageView(location.pathname, params);
|
const isInPostView = isPostPageView(location.pathname, params);
|
||||||
|
|
||||||
const [showFullComment, setShowFullComment] = useState(false);
|
const [showFullComment, setShowFullComment] = useState(false);
|
||||||
const displayContent = content && !isInPostView && content.length > 1000 && !showFullComment ? content.slice(0, 1000) : content;
|
const displayContent =
|
||||||
|
content &&
|
||||||
|
(!isInPostView && content.length > 1000 && !showFullComment
|
||||||
|
? content.slice(0, 1000)
|
||||||
|
: isInPostView && content.length > 2000 && !showFullComment
|
||||||
|
? content.slice(0, 2000)
|
||||||
|
: content);
|
||||||
|
|
||||||
const quotelinkReply = useComment({ commentCid: parentCid });
|
const quotelinkReply = useComment({ commentCid: parentCid });
|
||||||
const isReply = parentCid;
|
const isReply = parentCid;
|
||||||
@@ -308,7 +314,7 @@ const PostMessageMobile = ({ post }: PostProps) => {
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
)} */}
|
)} */}
|
||||||
{content?.length > 1000 && !isInPostView && !showFullComment && (
|
{((!isInPostView && content?.length > 1000 && !showFullComment) || (isInPostView && content?.length > 2000 && !showFullComment)) && (
|
||||||
<span className={styles.abbr}>
|
<span className={styles.abbr}>
|
||||||
<br />
|
<br />
|
||||||
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <span onClick={() => setShowFullComment(true)} /> }} />
|
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <span onClick={() => setShowFullComment(true)} /> }} />
|
||||||
|
|||||||
Reference in New Issue
Block a user