( chatId: string, subChatId: string )
| 533 | * Get full sub-chat draft including attachments and text contexts |
| 534 | */ |
| 535 | export function getSubChatDraftFull( |
| 536 | chatId: string, |
| 537 | subChatId: string |
| 538 | ): FullDraftData | null { |
| 539 | const globalDrafts = loadGlobalDrafts() |
| 540 | const key = getSubChatDraftKey(chatId, subChatId) |
| 541 | const draft = globalDrafts[key] as DraftContent | undefined |
| 542 | |
| 543 | if (!draft) return null |
| 544 | |
| 545 | return { |
| 546 | text: draft.text || null, |
| 547 | images: |
| 548 | draft.images |
| 549 | ?.map(fromDraftImage) |
| 550 | .filter((img): img is UploadedImage => img !== null) ?? [], |
| 551 | files: |
| 552 | draft.files |
| 553 | ?.map(fromDraftFile) |
| 554 | .filter((f): f is UploadedFile => f !== null) ?? [], |
| 555 | textContexts: draft.textContexts?.map(fromDraftTextContext) ?? [], |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | /** |
| 560 | * Save sub-chat draft with attachments (async version) |
no test coverage detected