From 73b086b6b8b53e78a63b86e5ed984d6aa6af6738 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 25 Sep 2023 13:29:43 +0200 Subject: [PATCH] upd: fetch ancestors --- packages/megalodon/src/misskey.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index fad27f70d7..3c3060301b 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -1191,10 +1191,19 @@ export default class Misskey implements MegalodonInterface { }) } } - return this.client.post>('/api/notes/children', params).then(res => { + return this.client.post>('/api/notes/children', params).then(async res => { + const conversation = await this.client.post>("/api/notes/conversation", params); + const parents = await Promise.all( + conversation.data.map((n) => + MisskeyAPI.Converter.note( + n, + this.baseUrl + ), + ), + ); const context: Entity.Context = { - ancestors: [], - descendants: res.data.map(n => MisskeyAPI.Converter.note(n)) + ancestors: parents.reverse(), + descendants: res.data.map(n => MisskeyAPI.Converter.note(n, this.baseUrl)) } return { ...res,