mirror of
https://github.com/versia-pub/server.git
synced 2025-12-08 09:18:19 +01:00
fix(api): 🐛 Fix quote serialization in API again
This commit is contained in:
parent
e8632caeac
commit
de0214c77e
|
|
@ -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 {
|
return {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
in_reply_to_id: data.replyId || null,
|
in_reply_to_id: data.replyId || null,
|
||||||
|
|
@ -492,7 +482,11 @@ export class Note {
|
||||||
pinned: wasPinnedByUser,
|
pinned: wasPinnedByUser,
|
||||||
// TODO: Add polls
|
// TODO: Add polls
|
||||||
poll: null,
|
poll: null,
|
||||||
reblog: reblog ?? null,
|
reblog: data.reblog
|
||||||
|
? await Note.fromStatus(
|
||||||
|
data.reblog as StatusWithRelations,
|
||||||
|
).toAPI(userFetching)
|
||||||
|
: null,
|
||||||
reblogged: wasRebloggedByUser,
|
reblogged: wasRebloggedByUser,
|
||||||
reblogs_count: data.reblogCount,
|
reblogs_count: data.reblogCount,
|
||||||
replies_count: data.replyCount,
|
replies_count: data.replyCount,
|
||||||
|
|
@ -508,8 +502,12 @@ export class Note {
|
||||||
visibility: data.visibility as APIStatus["visibility"],
|
visibility: data.visibility as APIStatus["visibility"],
|
||||||
url: data.uri || this.getMastoURI(),
|
url: data.uri || this.getMastoURI(),
|
||||||
bookmarked: false,
|
bookmarked: false,
|
||||||
quote: !!data.quotingId,
|
// @ts-expect-error Glitch-SOC extension
|
||||||
// @ts-expect-error Pleroma extension
|
quote: data.quotingId
|
||||||
|
? (await Note.fromId(data.quotingId).then((n) =>
|
||||||
|
n?.toAPI(userFetching),
|
||||||
|
)) ?? null
|
||||||
|
: null,
|
||||||
quote_id: data.quotingId || undefined,
|
quote_id: data.quotingId || undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,8 @@ describe(meta.route, () => {
|
||||||
expect(object2.content).toBe("<p>Hello, world again!</p>");
|
expect(object2.content).toBe("<p>Hello, world again!</p>");
|
||||||
// @ts-expect-error Pleroma extension
|
// @ts-expect-error Pleroma extension
|
||||||
expect(object2.quote_id).toBe(object.id);
|
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", () => {
|
describe("mentions testing", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue