mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat: quote repost
This commit is contained in:
parent
7c14a2d5ef
commit
77e5f4df2c
3 changed files with 9 additions and 0 deletions
|
|
@ -42,6 +42,7 @@ const instanceController: AppController = async (c) => {
|
||||||
'mastodon_api',
|
'mastodon_api',
|
||||||
'mastodon_api_streaming',
|
'mastodon_api_streaming',
|
||||||
'exposable_reactions',
|
'exposable_reactions',
|
||||||
|
'quote_posting',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ const createStatusSchema = z.object({
|
||||||
spoiler_text: z.string().nullish(),
|
spoiler_text: z.string().nullish(),
|
||||||
status: z.string().nullish(),
|
status: z.string().nullish(),
|
||||||
visibility: z.enum(['public', 'unlisted', 'private', 'direct']).nullish(),
|
visibility: z.enum(['public', 'unlisted', 'private', 'direct']).nullish(),
|
||||||
|
quote_id: z.string().nullish(),
|
||||||
}).refine(
|
}).refine(
|
||||||
(data) => Boolean(data.status || data.media_ids?.length),
|
(data) => Boolean(data.status || data.media_ids?.length),
|
||||||
{ message: 'Status must contain text or media.' },
|
{ message: 'Status must contain text or media.' },
|
||||||
|
|
@ -69,6 +70,10 @@ const createStatusController: AppController = async (c) => {
|
||||||
|
|
||||||
const tags: string[][] = [];
|
const tags: string[][] = [];
|
||||||
|
|
||||||
|
if (data.quote_id) {
|
||||||
|
tags.push(['q', data.quote_id]);
|
||||||
|
}
|
||||||
|
|
||||||
if (data.in_reply_to_id) {
|
if (data.in_reply_to_id) {
|
||||||
tags.push(['e', data.in_reply_to_id, 'reply']);
|
tags.push(['e', data.in_reply_to_id, 'reply']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ async function renderStatus(event: DittoEvent, viewerPubkey?: string) {
|
||||||
|
|
||||||
const media = [...mediaLinks, ...mediaTags];
|
const media = [...mediaLinks, ...mediaTags];
|
||||||
|
|
||||||
|
const quoteId = event.tags.find(([name]) => name === 'q')?.[1];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
account,
|
account,
|
||||||
|
|
@ -97,6 +99,7 @@ async function renderStatus(event: DittoEvent, viewerPubkey?: string) {
|
||||||
uri: Conf.external(note),
|
uri: Conf.external(note),
|
||||||
url: Conf.external(note),
|
url: Conf.external(note),
|
||||||
zapped: Boolean(zapEvent),
|
zapped: Boolean(zapEvent),
|
||||||
|
quote: !quoteId ? null : quoteId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue