diff --git a/components/comment.js b/components/comment.js index 386c1985..2e9347db 100644 --- a/components/comment.js +++ b/components/comment.js @@ -212,7 +212,7 @@ export default function Comment ({ {item.searchText ? : ( - + {item.outlawed && !me?.privates?.wildWestMode ? '*stackers have outlawed this. turn on wild west mode in your [settings](/settings) to see outlawed content.*' : truncate ? truncateString(item.text) : item.text} diff --git a/components/item-full.js b/components/item-full.js index 251027ef..b671e2cf 100644 --- a/components/item-full.js +++ b/components/item-full.js @@ -171,7 +171,7 @@ function TopLevelItem ({ item, noReply, ...props }) { function ItemText ({ item }) { return item.searchText ? - : {item.text} + : {item.text} } export default function ItemFull ({ item, bio, rank, ...props }) { diff --git a/components/text.js b/components/text.js index dc1c6e61..9f8583ad 100644 --- a/components/text.js +++ b/components/text.js @@ -34,7 +34,7 @@ export function SearchText ({ text }) { } // this is one of the slowest components to render -export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, ...outerProps }) { +export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, outlawed, ...outerProps }) { const [overflowing, setOverflowing] = useState(false) const router = useRouter() const [show, setShow] = useState(false) @@ -139,6 +139,10 @@ export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, . const Img = useCallback(({ node, src, ...props }) => { const url = IMGPROXY_URL_REGEXP.test(src) ? decodeOriginalUrl(src) : src + // if outlawed, render the image link as text + if (outlawed) { + return url + } const srcSet = imgproxyUrls?.[url] return }, [imgproxyUrls, outerProps, tab]) @@ -166,6 +170,11 @@ export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, . return <>{children} } + // if outlawed, render the link as text + if (outlawed) { + return href + } + // If [text](url) was parsed as and text is not empty and not a link itself, // we don't render it as an image since it was probably a conscious choice to include text. const text = children[0]