feat: diff-sync follows

This commit is contained in:
2024-04-15 22:31:51 +01:00
parent edf64e4125
commit 5a7657a95d
25 changed files with 320 additions and 154 deletions

View File

@ -4,6 +4,7 @@ import { Link } from "react-router-dom";
import { MediaElement } from "@/Components/Embed/MediaElement";
import Reveal from "@/Components/Event/Reveal";
import useFollowsControls from "@/Hooks/useFollowControls";
import useLogin from "@/Hooks/useLogin";
import { FileExtensionRegex } from "@/Utils/Const";
@ -16,13 +17,13 @@ interface RevealMediaProps {
}
export default function RevealMedia(props: RevealMediaProps) {
const { preferences, follows, publicKey } = useLogin(s => ({
const { preferences, publicKey } = useLogin(s => ({
preferences: s.appData.json.preferences,
follows: s.follows.item,
publicKey: s.publicKey,
}));
const { isFollowing } = useFollowsControls();
const hideNonFollows = preferences.autoLoadMedia === "follows-only" && !follows.includes(props.creator);
const hideNonFollows = preferences.autoLoadMedia === "follows-only" && !isFollowing(props.creator);
const isMine = props.creator === publicKey;
const hideMedia = preferences.autoLoadMedia === "none" || (!isMine && hideNonFollows);
const hostname = new URL(props.link).hostname;