mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
Allow quoting in UI
This commit is contained in:
parent
07d51e10df
commit
991a2cba84
|
|
@ -54,6 +54,7 @@ export default async (
|
||||||
"poll[multiple]": multiple,
|
"poll[multiple]": multiple,
|
||||||
"poll[options]": options,
|
"poll[options]": options,
|
||||||
in_reply_to_id,
|
in_reply_to_id,
|
||||||
|
quote_id,
|
||||||
language,
|
language,
|
||||||
scheduled_at,
|
scheduled_at,
|
||||||
sensitive,
|
sensitive,
|
||||||
|
|
@ -68,6 +69,7 @@ export default async (
|
||||||
"poll[multiple]"?: boolean;
|
"poll[multiple]"?: boolean;
|
||||||
"poll[hide_totals]"?: boolean;
|
"poll[hide_totals]"?: 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?: "public" | "unlisted" | "private" | "direct";
|
visibility?: "public" | "unlisted" | "private" | "direct";
|
||||||
|
|
@ -178,6 +180,7 @@ export default async (
|
||||||
// Get reply account and status if exists
|
// Get reply account and status if exists
|
||||||
let replyStatus: StatusWithRelations | null = null;
|
let replyStatus: StatusWithRelations | null = null;
|
||||||
let replyUser: UserWithRelations | null = null;
|
let replyUser: UserWithRelations | null = null;
|
||||||
|
let quote: StatusWithRelations | null = null;
|
||||||
|
|
||||||
if (in_reply_to_id) {
|
if (in_reply_to_id) {
|
||||||
replyStatus = await client.status.findUnique({
|
replyStatus = await client.status.findUnique({
|
||||||
|
|
@ -185,7 +188,22 @@ export default async (
|
||||||
include: statusAndUserRelations,
|
include: statusAndUserRelations,
|
||||||
});
|
});
|
||||||
|
|
||||||
replyUser = replyStatus?.author || null;
|
if (!replyStatus) {
|
||||||
|
return errorResponse("Reply status not found", 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
replyUser = replyStatus.author;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quote_id) {
|
||||||
|
quote = await client.status.findUnique({
|
||||||
|
where: { id: quote_id },
|
||||||
|
include: statusAndUserRelations,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!quote) {
|
||||||
|
return errorResponse("Quote status not found", 404);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if status body doesnt match filters
|
// Check if status body doesnt match filters
|
||||||
|
|
@ -229,6 +247,7 @@ export default async (
|
||||||
status: replyStatus,
|
status: replyStatus,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
|
quote: quote || undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: add database jobs to deliver the post
|
// TODO: add database jobs to deliver the post
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue