[mastodon-client] Add support for quote_id parameter when creating posts (#515)

This commit is contained in:
Laura Hausmann 2024-02-13 16:51:08 +01:00
parent 63fa244ea8
commit e49d168ecd
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 6 additions and 1 deletions

View file

@ -55,6 +55,7 @@ namespace MastodonEntity {
multiple: boolean multiple: boolean
}, },
in_reply_to_id?: string, in_reply_to_id?: string,
quote_id?: string,
sensitive?: boolean, sensitive?: boolean,
spoiler_text?: string, spoiler_text?: string,
visibility?: string, visibility?: string,

View file

@ -292,6 +292,7 @@ export class NoteHelpers {
: []; : [];
const reply = request.in_reply_to_id ? await getNote(request.in_reply_to_id, user) : undefined; const reply = request.in_reply_to_id ? await getNote(request.in_reply_to_id, user) : undefined;
const renote = request.quote_id ? await getNote(request.quote_id, user) : undefined;
const visibility = request.visibility ?? UserHelpers.getDefaultNoteVisibility(ctx); const visibility = request.visibility ?? UserHelpers.getDefaultNoteVisibility(ctx);
const data = { const data = {
@ -306,6 +307,7 @@ export class NoteHelpers {
: undefined, : undefined,
text: request.text, text: request.text,
reply: reply, reply: reply,
renote: renote,
cw: request.spoiler_text, cw: request.spoiler_text,
visibility: visibility, visibility: visibility,
visibleUsers: Promise.resolve(visibility).then(p => p === 'specified' ? this.extractMentions(request.text ?? '', ctx) : undefined) visibleUsers: Promise.resolve(visibility).then(p => p === 'specified' ? this.extractMentions(request.text ?? '', ctx) : undefined)
@ -356,6 +358,8 @@ export class NoteHelpers {
result.scheduled_at = new Date(Date.parse(body.scheduled_at)); result.scheduled_at = new Date(Date.parse(body.scheduled_at));
if (body.in_reply_to_id) if (body.in_reply_to_id)
result.in_reply_to_id = body.in_reply_to_id; result.in_reply_to_id = body.in_reply_to_id;
if (body.quote_id)
result.quote_id = body.quote_id;
if (body.media_ids) if (body.media_ids)
result.media_ids = body.media_ids && body.media_ids.length > 0 result.media_ids = body.media_ids && body.media_ids.length > 0
? toArray(body.media_ids) ? toArray(body.media_ids)