From 57f35be999667975dc275e3ebee95d2c8841f9d2 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 7e9bc6c8a..e05a12eaa 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>> {