refactor: rename isTextRepost to tagFilterOfTextRepost

This commit is contained in:
kPherox
2023-02-16 23:11:29 +09:00
parent d911dc8da3
commit 188b599e85
5 changed files with 10 additions and 10 deletions

View File

@ -11,7 +11,7 @@ import Pin from "Icons/Pin";
import { parseZap } from "Element/Zap";
import ProfileImage from "Element/ProfileImage";
import Text from "Element/Text";
import { eventLink, getReactions, dedupeByPubkey, isTextRepost, hexToBech32, normalizeReaction, Reaction } from "Util";
import { eventLink, getReactions, dedupeByPubkey, tagFilterOfTextRepost, hexToBech32, normalizeReaction, Reaction } from "Util";
import NoteFooter, { Translation } from "Element/NoteFooter";
import NoteTime from "Element/NoteTime";
import { useUserProfiles } from "Feed/ProfileFeed";
@ -101,7 +101,7 @@ export default function Note(props: NoteProps) {
const reposts = useMemo(
() =>
dedupeByPubkey([
...getReactions(related, ev.Id, EventKind.TextNote).filter(e => e.tags.some(isTextRepost(e, ev.Id))),
...getReactions(related, ev.Id, EventKind.TextNote).filter(e => e.tags.some(tagFilterOfTextRepost(e, ev.Id))),
...getReactions(related, ev.Id, EventKind.Repost),
]),
[related, ev]

View File

@ -4,7 +4,7 @@ import { useCallback, useMemo } from "react";
import { useInView } from "react-intersection-observer";
import ArrowUp from "Icons/ArrowUp";
import { dedupeByPubkey, isTextRepost } from "Util";
import { dedupeByPubkey, tagFilterOfTextRepost } from "Util";
import ProfileImage from "Element/ProfileImage";
import useTimelineFeed, { TimelineSubject } from "Feed/TimelineFeed";
import { TaggedRawEvent } from "@snort/nostr";
@ -72,7 +72,7 @@ export default function Timeline({
return <ProfilePreview actions={<></>} pubkey={e.pubkey} className="card" />;
}
case EventKind.TextNote: {
const eRef = e.tags.find(isTextRepost(e))?.at(1);
const eRef = e.tags.find(tagFilterOfTextRepost(e))?.at(1);
if (eRef) {
return <NoteReaction data={e} key={e.id} root={parent.notes.find(a => a.id === eRef)} />;
}