Use findReplyTag from Mostr
This commit is contained in:
parent
b42d1f3564
commit
26cf528fca
|
@ -1,4 +1,4 @@
|
|||
import { Author, type Filter, matchFilter, RelayPool } from '@/deps.ts';
|
||||
import { Author, type Filter, findReplyTag, matchFilter, RelayPool } from '@/deps.ts';
|
||||
import { type Event, type SignedEvent } from '@/event.ts';
|
||||
|
||||
import { poolRelays } from './config.ts';
|
||||
|
@ -99,9 +99,7 @@ function getFeed(event3: Event<3>, params: PaginationParams = {}): Promise<Signe
|
|||
|
||||
async function getAncestors(event: Event<1>, result = [] as Event<1>[]): Promise<Event<1>[]> {
|
||||
if (result.length < 100) {
|
||||
const replyTag = event.tags
|
||||
.find((t) => t[0] === 'e' && (!t[2] || t[2] === 'reply' || t[2] === 'root'));
|
||||
|
||||
const replyTag = findReplyTag(event);
|
||||
const inReplyTo = replyTag ? replyTag[1] : undefined;
|
||||
|
||||
if (inReplyTo) {
|
||||
|
|
|
@ -20,3 +20,4 @@ export {
|
|||
nip21,
|
||||
signEvent as getSignature,
|
||||
} from 'npm:nostr-tools@^1.10.1';
|
||||
export { findReplyTag } from 'https://gitlab.com/soapbox-pub/mostr/-/raw/c67064aee5ade5e01597c6d23e22e53c628ef0e2/src/nostr/tags.ts';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { nip19 } from '@/deps.ts';
|
||||
import { findReplyTag, nip19 } from '@/deps.ts';
|
||||
import { type Event } from '@/event.ts';
|
||||
import { type MetaContent, parseContent } from '@/schema.ts';
|
||||
|
||||
|
@ -73,8 +73,7 @@ async function toStatus(event: Event<1>) {
|
|||
const account = profile ? toAccount(profile) : undefined;
|
||||
if (!account) return;
|
||||
|
||||
const inReplyTo = event.tags
|
||||
.find((tag) => tag[0] === 'e' && (!tag[3] || tag[3] === 'reply' || tag[3] === 'root'));
|
||||
const replyTag = findReplyTag(event);
|
||||
|
||||
const mentionedPubkeys = [
|
||||
...new Set(
|
||||
|
@ -89,7 +88,7 @@ async function toStatus(event: Event<1>) {
|
|||
account,
|
||||
content: event.content,
|
||||
created_at: new Date(event.created_at * 1000).toISOString(),
|
||||
in_reply_to_id: inReplyTo ? inReplyTo[1] : null,
|
||||
in_reply_to_id: replyTag ? replyTag[1] : null,
|
||||
in_reply_to_account_id: null,
|
||||
sensitive: false,
|
||||
spoiler_text: '',
|
||||
|
|
Loading…
Reference in New Issue