@@ -238,7 +238,7 @@ describe.sequential("/api/v1/timelines/home", () => {
238238 } ) ;
239239
240240 it ( "serializes quotes using the Mastodon Quote entity format" , async ( ) => {
241- expect . assertions ( 7 ) ;
241+ expect . assertions ( 9 ) ;
242242
243243 const authorId = crypto . randomUUID ( ) as Uuid ;
244244 const quotedPostId = uuidv7 ( ) ;
@@ -289,7 +289,10 @@ describe.sequential("/api/v1/timelines/home", () => {
289289 quoteTargetId : quotedPostId ,
290290 visibility : "public" ,
291291 content : "Quote post" ,
292- contentHtml : "<p>Quote post</p>" ,
292+ contentHtml :
293+ "<p>Quote post</p>" +
294+ `<p class="quote-inline">RE: <a href="https://remote.test/notes/${ quotedPostId } ">` +
295+ `https://remote.test/notes/${ quotedPostId } </a></p>` ,
293296 published : new Date ( ) ,
294297 } ,
295298 ] ) ;
@@ -308,8 +311,76 @@ describe.sequential("/api/v1/timelines/home", () => {
308311
309312 expect ( Array . isArray ( json ) ) . toBe ( true ) ;
310313 expect ( json [ 0 ] . id ) . toBe ( quotePostId ) ;
314+ expect ( json [ 0 ] . content ) . toBe ( "<p>Quote post</p>" ) ;
315+ expect ( json [ 0 ] . content ) . not . toContain ( "quote-inline" ) ;
311316 expect ( json [ 0 ] . quote_id ) . toBe ( quotedPostId ) ;
312317 expect ( json [ 0 ] . quote . state ) . toBe ( "accepted" ) ;
313318 expect ( json [ 0 ] . quote . quoted_status . id ) . toBe ( quotedPostId ) ;
314319 } ) ;
320+
321+ it ( "keeps quote-inline fallback content without a structured quote" , async ( ) => {
322+ expect . assertions ( 6 ) ;
323+
324+ const authorId = crypto . randomUUID ( ) as Uuid ;
325+ const postId = uuidv7 ( ) ;
326+ const quotedPostUrl = "https://remote.test/notes/missing" ;
327+ const contentHtml =
328+ "<p>Quote post</p>" +
329+ `<p class="quote-inline">RE: <a href="${ quotedPostUrl } ">` +
330+ `${ quotedPostUrl } </a></p>` ;
331+
332+ await db
333+ . insert ( instances )
334+ . values ( { host : "remote.test" } )
335+ . onConflictDoNothing ( ) ;
336+
337+ await db . insert ( accounts ) . values ( {
338+ id : authorId ,
339+ iri : "https://remote.test/users/author" ,
340+ instanceHost : "remote.test" ,
341+ type : "Person" ,
342+ name : "Remote author" ,
343+ emojis : { } ,
344+ handle : "@author@remote.test" ,
345+ bioHtml : "" ,
346+ url : "https://remote.test/@author" ,
347+ protected : false ,
348+ inboxUrl : "https://remote.test/users/author/inbox" ,
349+ } ) ;
350+
351+ await db . insert ( follows ) . values ( {
352+ iri : "https://hollo.test/follows/author" ,
353+ followingId : authorId ,
354+ followerId : owner . id ,
355+ approved : new Date ( ) ,
356+ } ) ;
357+
358+ await db . insert ( posts ) . values ( {
359+ id : postId ,
360+ iri : `https://remote.test/notes/${ postId } ` ,
361+ type : "Note" ,
362+ accountId : authorId ,
363+ visibility : "public" ,
364+ content : "Quote post" ,
365+ contentHtml,
366+ published : new Date ( ) ,
367+ } ) ;
368+
369+ const response = await app . request ( "/api/v1/timelines/home" , {
370+ method : "GET" ,
371+ headers : {
372+ authorization : bearerAuthorization ( accessToken ) ,
373+ } ,
374+ } ) ;
375+
376+ expect ( response . status ) . toBe ( 200 ) ;
377+
378+ const json = await response . json ( ) ;
379+
380+ expect ( Array . isArray ( json ) ) . toBe ( true ) ;
381+ expect ( json [ 0 ] . id ) . toBe ( postId ) ;
382+ expect ( json [ 0 ] . quote ) . toBeNull ( ) ;
383+ expect ( json [ 0 ] . content ) . toContain ( "quote-inline" ) ;
384+ expect ( json [ 0 ] . content ) . toContain ( quotedPostUrl ) ;
385+ } ) ;
315386} ) ;
0 commit comments