fix: hide blocked replies

This commit is contained in:
Kieran 2023-10-13 11:16:37 +01:00
parent 3b363d988e
commit 9b66b7b1da
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -4,6 +4,7 @@ import { EventExt, NostrLink, TaggedNostrEvent, u256 } from "@snort/system";
import useThreadFeed from "Feed/ThreadFeed";
import { ReactNode, createContext, useMemo, useState } from "react";
import { useLocation } from "react-router-dom";
import useModeration from "./useModeration";
export interface ThreadContext {
current: string;
@ -36,12 +37,14 @@ export function ThreadContextWrapper({ link, children }: { link: NostrLink; chil
const location = useLocation();
const [currentId, setCurrentId] = useState(unwrap(link.toEventTag())[1]);
const feed = useThreadFeed(link);
const { isBlocked } = useModeration();
const chains = useMemo(() => {
const chains = new Map<u256, Array<TaggedNostrEvent>>();
if (feed.thread) {
feed.thread
?.sort((a, b) => b.created_at - a.created_at)
.filter(a => !isBlocked(a.pubkey))
.forEach(v => {
const replyTo = replyChainKey(v);
if (replyTo) {