mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 09:43:08 +02:00
upd: update user data fetching on masto api
This commit is contained in:
parent
c10f785614
commit
06630c097b
3 changed files with 12 additions and 8 deletions
|
@ -344,6 +344,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: profile!.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,
|
||||||
|
@ -355,6 +356,9 @@ export class UserEntityService implements OnModuleInit {
|
||||||
faviconUrl: instance.faviconUrl,
|
faviconUrl: instance.faviconUrl,
|
||||||
themeColor: instance.themeColor,
|
themeColor: instance.themeColor,
|
||||||
} : undefined) : undefined,
|
} : undefined) : undefined,
|
||||||
|
followersCount: followersCount ?? 0,
|
||||||
|
followingCount: followingCount ?? 0,
|
||||||
|
notesCount: user.notesCount,
|
||||||
emojis: this.customEmojiService.populateEmojis(user.emojis, user.host),
|
emojis: this.customEmojiService.populateEmojis(user.emojis, user.host),
|
||||||
onlineStatus: this.getOnlineStatus(user),
|
onlineStatus: this.getOnlineStatus(user),
|
||||||
// パフォーマンス上の理由でローカルユーザーのみ
|
// パフォーマンス上の理由でローカルユーザーのみ
|
||||||
|
@ -379,16 +383,12 @@ 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,
|
||||||
lang: profile!.lang,
|
lang: profile!.lang,
|
||||||
fields: profile!.fields,
|
fields: profile!.fields,
|
||||||
verifiedLinks: profile!.verifiedLinks,
|
verifiedLinks: profile!.verifiedLinks,
|
||||||
followersCount: followersCount ?? 0,
|
|
||||||
followingCount: followingCount ?? 0,
|
|
||||||
notesCount: user.notesCount,
|
|
||||||
pinnedNoteIds: pins.map(pin => pin.noteId),
|
pinnedNoteIds: pins.map(pin => pin.noteId),
|
||||||
pinnedNotes: this.noteEntityService.packMany(pins.map(pin => pin.note!), me, {
|
pinnedNotes: this.noteEntityService.packMany(pins.map(pin => pin.note!), me, {
|
||||||
detail: true,
|
detail: true,
|
||||||
|
|
|
@ -88,10 +88,10 @@ namespace MisskeyAPI {
|
||||||
suspended: null,
|
suspended: null,
|
||||||
limited: null,
|
limited: null,
|
||||||
created_at: u.createdAt ? u.createdAt : '',
|
created_at: u.createdAt ? u.createdAt : '',
|
||||||
followers_count: 0,
|
followers_count: u.followersCount ? u.followersCount : 0,
|
||||||
following_count: 0,
|
following_count: u.followingCount ? u.followingCount : 0,
|
||||||
statuses_count: 0,
|
statuses_count: u.notesCount ? u.notesCount : 0,
|
||||||
note: '',
|
note: u.description ? u.description : '',
|
||||||
url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct,
|
url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct,
|
||||||
avatar: u.avatarUrl,
|
avatar: u.avatarUrl,
|
||||||
avatar_static: u.avatarColor,
|
avatar_static: u.avatarColor,
|
||||||
|
|
|
@ -5,7 +5,11 @@ namespace MisskeyEntity {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
username: string
|
username: string
|
||||||
|
description?: string
|
||||||
createdAt?: string
|
createdAt?: string
|
||||||
|
followingCount?: number
|
||||||
|
followersCount?: number
|
||||||
|
notesCount?: number
|
||||||
host: string | null
|
host: string | null
|
||||||
avatarUrl: string
|
avatarUrl: string
|
||||||
avatarColor: string
|
avatarColor: string
|
||||||
|
|
Loading…
Reference in a new issue