Merge pull request #314 from kphrx/feat/kind1-reposts
feat: render kind 1 reposts
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { u256 } from "@snort/nostr";
|
||||
import { EventKind, Subscriptions } from "@snort/nostr";
|
||||
import { unixNow, unwrap } from "Util";
|
||||
import { unixNow, unwrap, tagFilterOfTextRepost } from "Util";
|
||||
import useSubscription from "Feed/Subscription";
|
||||
import { useSelector } from "react-redux";
|
||||
import { RootState } from "State/Store";
|
||||
@ -147,11 +147,19 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
|
||||
}
|
||||
return s;
|
||||
});
|
||||
const reposts = main.store.notes
|
||||
const repostsByKind6 = main.store.notes
|
||||
.filter(a => a.kind === EventKind.Repost && a.content === "")
|
||||
.map(a => a.tags.find(b => b[0] === "e"))
|
||||
.filter(a => a)
|
||||
.map(a => unwrap(a)[1]);
|
||||
const repostsByKind1 = main.store.notes
|
||||
.filter(
|
||||
a => (a.kind === EventKind.Repost || a.kind === EventKind.TextNote) && a.tags.some(tagFilterOfTextRepost(a))
|
||||
)
|
||||
.map(a => a.tags.find(tagFilterOfTextRepost(a)))
|
||||
.filter(a => a)
|
||||
.map(a => unwrap(a)[1]);
|
||||
const reposts = [...repostsByKind6, ...repostsByKind1];
|
||||
if (reposts.length > 0) {
|
||||
setTrackingParentEvents(s => {
|
||||
if (reposts.some(a => !s.includes(a))) {
|
||||
|
Reference in New Issue
Block a user