mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 11:27:31 -07:00
[mastodon-client] Add support for quote_id parameter when creating posts (#515)
This commit is contained in:
parent
63fa244ea8
commit
e49d168ecd
2 changed files with 6 additions and 1 deletions
|
@ -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,
|
||||||
|
|
|
@ -291,7 +291,8 @@ export class NoteHelpers {
|
||||||
? DriveFiles.findByIds(request.media_ids)
|
? DriveFiles.findByIds(request.media_ids)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue