Merge branch 'quote-repost-quote' into 'main'

quote_repost -> quote

See merge request soapbox-pub/ditto!237
This commit is contained in:
Alex Gleason 2024-05-08 19:58:40 +00:00
commit ccf126516d
4 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ export interface DittoEvent extends NostrEvent {
d_author?: DittoEvent;
user?: DittoEvent;
repost?: DittoEvent;
quote_repost?: DittoEvent;
quote?: DittoEvent;
reacted?: DittoEvent;
/** The profile being reported.
* Must be a kind 0 hydrated.

View File

@ -96,7 +96,7 @@ Deno.test('hydrateEvents(): quote repost --- WITHOUT stats', async () => {
const expectedEvent1quoteRepost = {
...event1quoteRepostCopy,
author: event0madeQuoteRepostCopy,
quote_repost: { ...event1willBeQuoteRepostedCopy, author: event0copy },
quote: { ...event1willBeQuoteRepostedCopy, author: event0copy },
};
assertEquals(event1quoteRepostCopy, expectedEvent1quoteRepost);
@ -127,7 +127,7 @@ Deno.test('hydrateEvents(): repost of quote repost --- WITHOUT stats', async ()
const expectedEvent6 = {
...event6copy,
author: event0copy,
repost: { ...event1quoteCopy, author: event0copy, quote_repost: { author: event0copy, ...event1copy } },
repost: { ...event1quoteCopy, author: event0copy, quote: { author: event0copy, ...event1copy } },
};
assertEquals(event6copy, expectedEvent6);
});

View File

@ -80,7 +80,7 @@ function assembleEvents(
if (event.kind === 1) {
const id = event.tags.find(([name]) => name === 'q')?.[1];
if (id) {
event.quote_repost = b.find((e) => matchFilter({ kinds: [1], ids: [id] }, e));
event.quote = b.find((e) => matchFilter({ kinds: [1], ids: [id] }, e));
}
}

View File

@ -109,7 +109,7 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
tags: [],
emojis: renderEmojis(event),
poll: null,
quote: !event.quote_repost ? null : await renderStatus(event.quote_repost, { depth: depth + 1 }),
quote: !event.quote ? null : await renderStatus(event.quote, { depth: depth + 1 }),
quote_id: event.tags.find(([name]) => name === 'q')?.[1] ?? null,
uri: Conf.external(note),
url: Conf.external(note),