pl-api: support familiar followers on pixelfed
Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
@ -725,9 +725,22 @@ class PlApiClient {
|
||||
* @see {@link https://docs.joinmastodon.org/methods/accounts/#familiar_followers}
|
||||
*/
|
||||
getFamiliarFollowers: async (accountIds: string[]) => {
|
||||
const response = await this.request('/api/v1/accounts/familiar_followers', { params: { id: accountIds } });
|
||||
let response: any;
|
||||
|
||||
return v.parse(filteredArray(familiarFollowersSchema), response.json);
|
||||
if (this.features.version.software === PIXELFED) {
|
||||
response = [];
|
||||
for (const accountId of accountIds) {
|
||||
const accounts = (await this.request(`/api/v1.1/accounts/mutuals/${accountId}`)).json;
|
||||
response.push({
|
||||
id: accountId,
|
||||
accounts,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
response = (await this.request('/api/v1/accounts/familiar_followers', { params: { id: accountIds } })).json;
|
||||
}
|
||||
|
||||
return v.parse(filteredArray(familiarFollowersSchema), response);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -569,6 +569,7 @@ const getFeatures = (instance: Instance) => {
|
||||
familiarFollowers: any([
|
||||
v.software === DITTO,
|
||||
v.software === MASTODON,
|
||||
v.software === PIXELFED,
|
||||
v.software === PLEROMA && gte(v.version, '2.6.0') && v.build === REBASED,
|
||||
v.software === PLEROMA && gte(v.version, '2.7.0'),
|
||||
v.software === TAKAHE,
|
||||
|
||||
Reference in New Issue
Block a user