Only allow trending link posts for current instance, not remote instance

For this to work on remote instance, will need to fetch its version and check first
This commit is contained in:
Lim Chee Aun 2024-06-26 17:26:41 +08:00
parent 1b3938f3d2
commit f7024f7723

View file

@ -72,6 +72,8 @@ function Trending({ columnMode, ...props }) {
// const navigate = useNavigate(); // const navigate = useNavigate();
const latestItem = useRef(); const latestItem = useRef();
const sameCurrentInstance = instance === currentInstance;
const [hashtags, setHashtags] = useState([]); const [hashtags, setHashtags] = useState([]);
const [links, setLinks] = useState([]); const [links, setLinks] = useState([]);
const trendIterator = useRef(); const trendIterator = useRef();
@ -137,7 +139,8 @@ function Trending({ columnMode, ...props }) {
const [currentLink, setCurrentLink] = useState(null); const [currentLink, setCurrentLink] = useState(null);
const hasCurrentLink = !!currentLink; const hasCurrentLink = !!currentLink;
const currentLinkRef = useRef(); const currentLinkRef = useRef();
const supportsTrendingLinkPosts = supports('@mastodon/trending-hashtags'); const supportsTrendingLinkPosts =
sameCurrentInstance && supports('@mastodon/trending-hashtags');
useEffect(() => { useEffect(() => {
if (currentLink && currentLinkRef.current) { if (currentLink && currentLinkRef.current) {