pl-fe: fix draft statuses regression

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-01-08 22:13:35 +01:00
parent fa1ca9298c
commit c042fac365

View File

@ -9,7 +9,15 @@ import { filteredArray } from 'pl-fe/schemas/utils';
import KVStore from 'pl-fe/storage/kv-store';
import { APIEntity } from 'pl-fe/types/entities';
const draftStatusSchema = v.object({
const draftStatusSchema = v.pipe(v.any(), v.transform((draft) => ({
content_type: draft.contentType,
draft_id: draft.draftId,
group_id: draft.groupId,
in_reply_to: draft.inReplyTo,
media_attachments: draft.mediaAttachments,
spoiler_text: draft.spoilerText,
...draft,
})), v.object({
content_type: v.fallback(v.string(), 'text/plain'),
draft_id: v.string(),
editorState: v.fallback(v.nullable(v.string()), null),
@ -23,7 +31,7 @@ const draftStatusSchema = v.object({
sensitive: v.fallback(v.boolean(), false),
spoiler_text: v.fallback(v.string(), ''),
text: v.fallback(v.string(), ''),
});
}));
type DraftStatus = v.InferOutput<typeof draftStatusSchema>;