fix: chat accepts posts

This commit is contained in:
gosangam
2026-08-29 16:26:53 +05:30
parent 76cd106ef7
commit 3e6a1c6f39
5 changed files with 118 additions and 21 deletions
+22
View File
@@ -188,6 +188,25 @@ export type Attachment = {
description?: string | null;
site_name?: string | null;
image_url?: string | null;
/** Shared entity. `entity` is resolved per viewer on every read, so it can
* be absent even though the message still references a post. */
entity_type?: "post" | null;
entity_id?: string | null;
entity?: SharedPost | null;
/** The post was deleted, hidden, or is no longer visible to this viewer. */
entity_unavailable?: boolean;
};
/** The post card the BFF resolves for a shared-post attachment. */
export type SharedPost = {
id: string;
author_handle: string;
author_name: string;
author_avatar_url?: string | null;
caption: string;
image_url?: string | null;
source_title?: string;
};
/** How two people in a DM stand with each other. */
@@ -261,6 +280,8 @@ export const chat = {
previewUrl?: string;
attachments?: UploadedAttachment[];
quote?: QuotePayload;
/** Share a post as a card. Only the reference — the BFF resolves it. */
entity?: { type: "post"; id: string };
},
) =>
call<ChatMessage>(`/chat/conversations/${conversationId}/messages`, {
@@ -273,6 +294,7 @@ export const chat = {
preview_url: opts?.previewUrl ?? null,
attachments: opts?.attachments ?? [],
quote: opts?.quote ?? null,
entity: opts?.entity ?? null,
}),
}),