@@ -148,7 +148,10 @@ vi.mock("../features/sharing/incoming-share-storage", () => ({
148148} ) ) ;
149149
150150import type { DraftComposerAttachment } from "../lib/composerImages" ;
151- import { formatComposerContextReference } from "@t3tools/shared/composerContextReferences" ;
151+ import {
152+ collectComposerContextReferences ,
153+ formatComposerContextReference ,
154+ } from "@t3tools/shared/composerContextReferences" ;
152155import { appAtomRegistry } from "./atom-registry" ;
153156import { threadOutboxManager } from "./thread-outbox" ;
154157import {
@@ -2304,6 +2307,35 @@ describe("mobile composer drafts", () => {
23042307 expect ( mergeComposerDraftContentState ( edited , draftKey , content ) ) . toBe ( edited ) ;
23052308 } ) ;
23062309
2310+ it ( "shows a shared non-image file as a composer chip" , ( ) => {
2311+ const draftKey = "new-task:environment-1:project-1" ;
2312+ const sharedFile = {
2313+ id : "share-1:file:0" ,
2314+ type : "file" as const ,
2315+ name : "backup.json" ,
2316+ mimeType : "application/json" ,
2317+ sizeBytes : 41 ,
2318+ fileUri : "file:///documents/backup.json" ,
2319+ } ;
2320+
2321+ const merged = mergeComposerDraftContentState ( { } , draftKey , {
2322+ text : "" ,
2323+ attachments : [ sharedFile ] ,
2324+ sourceShareId : "share-1" ,
2325+ } ) [ draftKey ] ! ;
2326+
2327+ expect ( merged . attachments ) . toEqual ( [ sharedFile ] ) ;
2328+ const references = collectComposerContextReferences ( merged . text ) ;
2329+ expect ( references ) . toHaveLength ( 1 ) ;
2330+ expect ( merged . context ?. records ) . toEqual ( [
2331+ expect . objectContaining ( {
2332+ kind : "file" ,
2333+ contextId : references [ 0 ] ! . contextId ,
2334+ attachmentId : sharedFile . id ,
2335+ } ) ,
2336+ ] ) ;
2337+ } ) ;
2338+
23072339 it ( "preserves existing images when shared content exceeds the draft attachment limit" , ( ) => {
23082340 const draftKey = "new-task:environment-1:project-1" ;
23092341 const image = ( id : string ) => ( {
0 commit comments