From b569ac911e334a17a07fb3f81229b215b8cbc53c Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 25 Sep 2023 21:27:39 +0200 Subject: [PATCH] add: description support for mastodon --- packages/backend/src/core/entities/UserEntityService.ts | 4 +++- packages/megalodon/src/misskey/api_client.ts | 2 +- packages/megalodon/src/misskey/entities/user.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 8e3db8b43..297617283 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -321,6 +321,8 @@ export class UserEntityService implements OnModuleInit { .getMany() : []; const profile = opts.detail ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null; + const mastoapi = opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id }); + const followingCount = profile == null ? null : (profile.ffVisibility === 'public') || isMe ? user.followingCount : (profile.ffVisibility === 'followers') && (relation && relation.isFollowing) ? user.followingCount : @@ -344,6 +346,7 @@ export class UserEntityService implements OnModuleInit { host: user.host, avatarUrl: user.avatarUrl ?? this.getIdenticonUrl(user), avatarBlurhash: user.avatarBlurhash, + description: mastoapi!.description, createdAt: user.createdAt.toISOString(), isBot: user.isBot ?? falsy, isCat: user.isCat ?? falsy, @@ -382,7 +385,6 @@ export class UserEntityService implements OnModuleInit { isLocked: user.isLocked, isSilenced: this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote), isSuspended: user.isSuspended ?? falsy, - description: profile!.description, location: profile!.location, birthday: profile!.birthday, listenbrainz: profile!.listenbrainz, diff --git a/packages/megalodon/src/misskey/api_client.ts b/packages/megalodon/src/misskey/api_client.ts index acfad963d..1193fba90 100644 --- a/packages/megalodon/src/misskey/api_client.ts +++ b/packages/megalodon/src/misskey/api_client.ts @@ -92,7 +92,7 @@ namespace MisskeyAPI { followers_count: u.followersCount ? u.followersCount : 0, following_count: u.followingCount ? u.followingCount : 0, statuses_count: u.notesCount ? u.notesCount : 0, - note: '', + note: u.description ? u.description : '', url: acctUrl, avatar: u.avatarUrl, avatar_static: u.avatarUrl, diff --git a/packages/megalodon/src/misskey/entities/user.ts b/packages/megalodon/src/misskey/entities/user.ts index 499c62e70..782e04d79 100644 --- a/packages/megalodon/src/misskey/entities/user.ts +++ b/packages/megalodon/src/misskey/entities/user.ts @@ -6,6 +6,7 @@ namespace MisskeyEntity { name: string username: string createdAt?: string + description?: string followingCount?: number followersCount?: number notesCount?: number