[backend/masto-client] Add follow_requests_count to verify_credentials response

This commit is contained in:
ari melody 2024-07-01 05:59:55 +01:00 committed by Laura Hausmann
parent 671b52c663
commit 2ebd907c47
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -215,6 +215,7 @@ export class UserHelpers {
const user = ctx.user as ILocalUser; const user = ctx.user as ILocalUser;
const acct = UserConverter.encode(user, ctx); const acct = UserConverter.encode(user, ctx);
const profile = UserProfiles.findOneByOrFail({ userId: user.id }); const profile = UserProfiles.findOneByOrFail({ userId: user.id });
const followRequests = FollowRequests.count({ where: { followeeId: user.id } });
const privacy = this.getDefaultNoteVisibility(ctx); const privacy = this.getDefaultNoteVisibility(ctx);
const fields = profile.then(profile => profile.fields.map(field => { const fields = profile.then(profile => profile.fields.map(field => {
return { return {
@ -229,6 +230,7 @@ export class UserHelpers {
privacy: privacy.then(p => VisibilityConverter.encode(p)), privacy: privacy.then(p => VisibilityConverter.encode(p)),
sensitive: profile.then(p => p.alwaysMarkNsfw), sensitive: profile.then(p => p.alwaysMarkNsfw),
language: profile.then(p => p.lang ?? ''), language: profile.then(p => p.lang ?? ''),
follow_requests_count: followRequests,
}; };
const result = { const result = {