fix(content): render content for current pubkey

This commit is contained in:
Fernando López Guevara
2023-02-10 00:21:19 -03:00
parent 2eedbd7f9c
commit 21a8fd20f7

View File

@ -22,17 +22,20 @@ import { HexKey } from "Nostr";
export default function HyperText({ link, creator }: { link: string; creator: HexKey }) { export default function HyperText({ link, creator }: { link: string; creator: HexKey }) {
const pref = useSelector((s: RootState) => s.login.preferences); const pref = useSelector((s: RootState) => s.login.preferences);
const follows = useSelector((s: RootState) => s.login.follows); const follows = useSelector((s: RootState) => s.login.follows);
const publicKey = useSelector((s: RootState) => s.login.publicKey);
const render = useCallback(() => { const render = useCallback(() => {
const a = link; const a = link;
try { try {
const hideNonFollows = pref.autoLoadMedia === "follows-only" && !follows.includes(creator); if (creator !== publicKey) {
if (pref.autoLoadMedia === "none" || hideNonFollows) { const hideNonFollows = pref.autoLoadMedia === "follows-only" && !follows.includes(creator);
return ( if (pref.autoLoadMedia === "none" || hideNonFollows) {
<a href={a} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext"> return (
{a} <a href={a} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext">
</a> {a}
); </a>
);
}
} }
const url = new URL(a); const url = new URL(a);
const youtubeId = YoutubeUrlRegex.test(a) && RegExp.$1; const youtubeId = YoutubeUrlRegex.test(a) && RegExp.$1;