add: description support for mastodon

This commit is contained in:
Mar0xy 2023-09-25 21:27:39 +02:00
parent a505e51777
commit b569ac911e
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
3 changed files with 5 additions and 2 deletions

View file

@ -321,6 +321,8 @@ export class UserEntityService implements OnModuleInit {
.getMany() : []; .getMany() : [];
const profile = opts.detail ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null; 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 : const followingCount = profile == null ? null :
(profile.ffVisibility === 'public') || isMe ? user.followingCount : (profile.ffVisibility === 'public') || isMe ? user.followingCount :
(profile.ffVisibility === 'followers') && (relation && relation.isFollowing) ? user.followingCount : (profile.ffVisibility === 'followers') && (relation && relation.isFollowing) ? user.followingCount :
@ -344,6 +346,7 @@ export class UserEntityService implements OnModuleInit {
host: user.host, host: user.host,
avatarUrl: user.avatarUrl ?? this.getIdenticonUrl(user), avatarUrl: user.avatarUrl ?? this.getIdenticonUrl(user),
avatarBlurhash: user.avatarBlurhash, avatarBlurhash: user.avatarBlurhash,
description: mastoapi!.description,
createdAt: user.createdAt.toISOString(), createdAt: user.createdAt.toISOString(),
isBot: user.isBot ?? falsy, isBot: user.isBot ?? falsy,
isCat: user.isCat ?? falsy, isCat: user.isCat ?? falsy,
@ -382,7 +385,6 @@ export class UserEntityService implements OnModuleInit {
isLocked: user.isLocked, isLocked: user.isLocked,
isSilenced: this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote), isSilenced: this.roleService.getUserPolicies(user.id).then(r => !r.canPublicNote),
isSuspended: user.isSuspended ?? falsy, isSuspended: user.isSuspended ?? falsy,
description: profile!.description,
location: profile!.location, location: profile!.location,
birthday: profile!.birthday, birthday: profile!.birthday,
listenbrainz: profile!.listenbrainz, listenbrainz: profile!.listenbrainz,

View file

@ -92,7 +92,7 @@ namespace MisskeyAPI {
followers_count: u.followersCount ? u.followersCount : 0, followers_count: u.followersCount ? u.followersCount : 0,
following_count: u.followingCount ? u.followingCount : 0, following_count: u.followingCount ? u.followingCount : 0,
statuses_count: u.notesCount ? u.notesCount : 0, statuses_count: u.notesCount ? u.notesCount : 0,
note: '', note: u.description ? u.description : '',
url: acctUrl, url: acctUrl,
avatar: u.avatarUrl, avatar: u.avatarUrl,
avatar_static: u.avatarUrl, avatar_static: u.avatarUrl,

View file

@ -6,6 +6,7 @@ namespace MisskeyEntity {
name: string name: string
username: string username: string
createdAt?: string createdAt?: string
description?: string
followingCount?: number followingCount?: number
followersCount?: number followersCount?: number
notesCount?: number notesCount?: number