mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-28 20:43:33 +02:00
handle muting repost events
dont show mute events on image view
This commit is contained in:
@@ -14,6 +14,7 @@ import { useReadRelayUrls } from "../../../hooks/use-client-relays";
|
||||
import { useRegisterIntersectionEntity } from "../../../providers/intersection-observer";
|
||||
import useSingleEvent from "../../../hooks/use-single-event";
|
||||
import { EmbedEvent } from "../../embed-event";
|
||||
import useUserMuteFilter from "../../../hooks/use-user-mute-filter";
|
||||
|
||||
function parseHardcodedNoteContent(event: NostrEvent) {
|
||||
const json = safeJson(event.content, null);
|
||||
@@ -31,15 +32,17 @@ export default function RepostNote({ event }: { event: NostrEvent }) {
|
||||
const ref = useRef<HTMLDivElement | null>(null);
|
||||
useRegisterIntersectionEntity(ref, event.id);
|
||||
|
||||
const muteFilter = useUserMuteFilter();
|
||||
const hardCodedNote = parseHardcodedNoteContent(event);
|
||||
|
||||
const [_, eventId, relay] = event.tags.find(isETag) ?? [];
|
||||
const readRelays = useReadRelayUrls(relay ? [relay] : []);
|
||||
|
||||
const loadedNote = useSingleEvent(eventId, readRelays);
|
||||
|
||||
const note = hardCodedNote || loadedNote;
|
||||
|
||||
if (note && muteFilter(note)) return;
|
||||
|
||||
return (
|
||||
<TrustProvider event={event}>
|
||||
<Flex gap="2" direction="column" ref={ref}>
|
||||
|
@@ -13,6 +13,7 @@ import { useRegisterIntersectionEntity } from "../../../providers/intersection-o
|
||||
import { Photo } from "react-photo-album";
|
||||
import { NostrEvent } from "../../../types/nostr-event";
|
||||
import { getEventUID } from "../../../helpers/nostr/events";
|
||||
import { Kind } from "nostr-tools";
|
||||
|
||||
function GalleryImage({ event, ...props }: EmbeddedImageProps & { event: NostrEvent }) {
|
||||
const ref = useRef<HTMLImageElement | null>(null);
|
||||
@@ -42,6 +43,7 @@ export default function MediaTimeline({ timeline }: { timeline: TimelineLoader }
|
||||
var images: PhotoWithEvent[] = [];
|
||||
|
||||
for (const event of events) {
|
||||
if (event.kind === Kind.Repost) continue;
|
||||
const urls = event.content.matchAll(getMatchLink());
|
||||
|
||||
let i = 0;
|
||||
|
Reference in New Issue
Block a user