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,10 +22,12 @@ import { HexKey } from "Nostr";
export default function HyperText({ link, creator }: { link: string; creator: HexKey }) {
const pref = useSelector((s: RootState) => s.login.preferences);
const follows = useSelector((s: RootState) => s.login.follows);
const publicKey = useSelector((s: RootState) => s.login.publicKey);
const render = useCallback(() => {
const a = link;
try {
if (creator !== publicKey) {
const hideNonFollows = pref.autoLoadMedia === "follows-only" && !follows.includes(creator);
if (pref.autoLoadMedia === "none" || hideNonFollows) {
return (
@ -34,6 +36,7 @@ export default function HyperText({ link, creator }: { link: string; creator: He
</a>
);
}
}
const url = new URL(a);
const youtubeId = YoutubeUrlRegex.test(a) && RegExp.$1;
const tweetId = TweetUrlRegex.test(a) && RegExp.$2;