upd: fetch ancestors

This commit is contained in:
Mar0xy 2023-09-25 13:29:43 +02:00
parent 219b45a3c0
commit 73b086b6b8
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -1191,10 +1191,19 @@ export default class Misskey implements MegalodonInterface {
})
}
}
return this.client.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/children', params).then(res => {
return this.client.post<Array<MisskeyAPI.Entity.Note>>('/api/notes/children', params).then(async res => {
const conversation = await this.client.post<Array<MisskeyAPI.Entity.Note>>("/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,