From 858549ce4193a527a2678ab26d02e5319298f63c Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 9 Jul 2023 00:31:24 +0200 Subject: [PATCH] [mastodon-client] populate user details for account following/followers --- packages/megalodon/src/misskey.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index 7e9bc6c8a9..e05a12eaad 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -474,11 +474,11 @@ export default class Misskey implements MegalodonInterface { limit: 40 }) } - return this.client.post>('/api/users/followers', params).then(res => { - return Object.assign(res, { - data: res.data.map(f => this.converter.follower(f)) - }) - }) + return this.client.post>('/api/users/followers', params).then(async res => { + return Object.assign(res, { + data: (await Promise.all(res.data.map(async f => (this.getAccount(f.followerId)).then(p => p.data)))) + }) + }) } /** @@ -502,11 +502,11 @@ export default class Misskey implements MegalodonInterface { }) } } - return this.client.post>('/api/users/following', params).then(res => { - return Object.assign(res, { - data: res.data.map(f => this.converter.following(f)) - }) - }) + return this.client.post>('/api/users/following', params).then(async res => { + return Object.assign(res, { + data: (await Promise.all(res.data.map(async f => (this.getAccount(f.followeeId)).then(p => p.data)))) + }) + }) } public async getAccountLists(_id: string): Promise>> {