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

feat: add support for quote repost

See merge request soapbox-pub/ditto!153
This commit is contained in:
Alex Gleason 2024-04-12 17:10:44 +00:00
commit a05b0dc473
2 changed files with 6 additions and 0 deletions

View File

@ -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',
], ],
}, },
}, },

View File

@ -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']);
} }