match attributionDomains entity to database schema
This commit is contained in:
parent
5f51f7878e
commit
3bf0a737c8
3 changed files with 21 additions and 7 deletions
|
|
@ -445,7 +445,11 @@ export class ApPersonService implements OnModuleInit, OnApplicationShutdown {
|
|||
makeNotesFollowersOnlyBefore: (person as any).makeNotesFollowersOnlyBefore ?? null,
|
||||
makeNotesHiddenBefore: (person as any).makeNotesHiddenBefore ?? null,
|
||||
emojis,
|
||||
attributionDomains: (Array.isArray(person.attributionDomains) && person.attributionDomains.every(x => typeof x === 'string')) ? person.attributionDomains : [],
|
||||
attributionDomains: Array.isArray(person.attributionDomains)
|
||||
? person.attributionDomains
|
||||
.filter((a: unknown) => typeof(a) === 'string' && a.length > 0 && a.length <= 128)
|
||||
.slice(0, 32)
|
||||
: [],
|
||||
})) as MiRemoteUser;
|
||||
|
||||
let _description: string | null = null;
|
||||
|
|
@ -629,7 +633,11 @@ export class ApPersonService implements OnModuleInit, OnApplicationShutdown {
|
|||
// We use "!== false" to handle incorrect types, missing / null values, and "default to true" logic.
|
||||
hideOnlineStatus: person.hideOnlineStatus !== false,
|
||||
isExplorable: person.discoverable !== false,
|
||||
attributionDomains: (Array.isArray(person.attributionDomains) && person.attributionDomains.every(x => typeof x === 'string')) ? person.attributionDomains : [],
|
||||
attributionDomains: Array.isArray(person.attributionDomains)
|
||||
? person.attributionDomains
|
||||
.filter((a: unknown) => typeof(a) === 'string' && a.length > 0 && a.length <= 128)
|
||||
.slice(0, 32)
|
||||
: [],
|
||||
...(await this.resolveAvatarAndBanner(exist, person.icon, person.image, person.backgroundUrl).catch(() => ({}))),
|
||||
} as Partial<MiRemoteUser> & Pick<MiRemoteUser, 'isBot' | 'isCat' | 'speakAsCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue