diff --git a/packages/database-interface/note.ts b/packages/database-interface/note.ts index 5edb9bb0..13f060f8 100644 --- a/packages/database-interface/note.ts +++ b/packages/database-interface/note.ts @@ -448,16 +448,6 @@ export class Note { ); } - const reblog = data.quotingId - ? await Note.fromId(data.quotingId).then((n) => - n?.toAPI(userFetching), - ) - : data.reblog - ? await Note.fromStatus(data.reblog as StatusWithRelations).toAPI( - userFetching, - ) - : null; - return { id: data.id, in_reply_to_id: data.replyId || null, @@ -492,7 +482,11 @@ export class Note { pinned: wasPinnedByUser, // TODO: Add polls poll: null, - reblog: reblog ?? null, + reblog: data.reblog + ? await Note.fromStatus( + data.reblog as StatusWithRelations, + ).toAPI(userFetching) + : null, reblogged: wasRebloggedByUser, reblogs_count: data.reblogCount, replies_count: data.replyCount, @@ -508,8 +502,12 @@ export class Note { visibility: data.visibility as APIStatus["visibility"], url: data.uri || this.getMastoURI(), bookmarked: false, - quote: !!data.quotingId, - // @ts-expect-error Pleroma extension + // @ts-expect-error Glitch-SOC extension + quote: data.quotingId + ? (await Note.fromId(data.quotingId).then((n) => + n?.toAPI(userFetching), + )) ?? null + : null, quote_id: data.quotingId || undefined, }; } diff --git a/server/api/api/v1/statuses/index.test.ts b/server/api/api/v1/statuses/index.test.ts index 34cdabb0..621734a2 100644 --- a/server/api/api/v1/statuses/index.test.ts +++ b/server/api/api/v1/statuses/index.test.ts @@ -294,7 +294,8 @@ describe(meta.route, () => { expect(object2.content).toBe("
Hello, world again!
"); // @ts-expect-error Pleroma extension expect(object2.quote_id).toBe(object.id); - expect(object2.reblog?.id).toBe(object.id); + // @ts-expect-error Glitch SOC extension + expect(object2.quote?.id).toBe(object.id); }); describe("mentions testing", () => {