Merge branch 'fix-create-status-quote-repost' into 'main'
Fix response when creating a status with quote repost See merge request soapbox-pub/ditto!160
This commit is contained in:
commit
a07d018ea6
|
@ -130,6 +130,16 @@ const createStatusController: AppController = async (c) => {
|
||||||
}, c);
|
}, c);
|
||||||
|
|
||||||
const author = await getAuthor(event.pubkey);
|
const author = await getAuthor(event.pubkey);
|
||||||
|
|
||||||
|
if (data.quote_id) {
|
||||||
|
await hydrateEvents({
|
||||||
|
events: [event],
|
||||||
|
relations: ['quote_repost'],
|
||||||
|
storage: eventsDB,
|
||||||
|
signal: c.req.raw.signal,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return c.json(await renderStatus({ ...event, author }, { viewerPubkey: c.get('pubkey') }));
|
return c.json(await renderStatus({ ...event, author }, { viewerPubkey: c.get('pubkey') }));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,6 @@ async function renderStatus(event: DittoEvent, opts: statusOpts): Promise<any> {
|
||||||
|
|
||||||
const media = [...mediaLinks, ...mediaTags];
|
const media = [...mediaLinks, ...mediaTags];
|
||||||
|
|
||||||
const quoteStatus = !event.quote_repost ? null : await renderStatus(event.quote_repost, { depth: depth + 1 });
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
account,
|
account,
|
||||||
|
@ -105,8 +103,8 @@ async function renderStatus(event: DittoEvent, opts: statusOpts): Promise<any> {
|
||||||
tags: [],
|
tags: [],
|
||||||
emojis: renderEmojis(event),
|
emojis: renderEmojis(event),
|
||||||
poll: null,
|
poll: null,
|
||||||
quote: quoteStatus,
|
quote: !event.quote_repost ? null : await renderStatus(event.quote_repost, { depth: depth + 1 }),
|
||||||
quote_id: quoteStatus ? quoteStatus.id : null,
|
quote_id: event.tags.find(([name]) => name === 'q')?.[1] ?? null,
|
||||||
uri: Conf.external(note),
|
uri: Conf.external(note),
|
||||||
url: Conf.external(note),
|
url: Conf.external(note),
|
||||||
zapped: Boolean(zapEvent),
|
zapped: Boolean(zapEvent),
|
||||||
|
|
Loading…
Reference in New Issue