mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
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,
|
makeNotesFollowersOnlyBefore: (person as any).makeNotesFollowersOnlyBefore ?? null,
|
||||||
makeNotesHiddenBefore: (person as any).makeNotesHiddenBefore ?? null,
|
makeNotesHiddenBefore: (person as any).makeNotesHiddenBefore ?? null,
|
||||||
emojis,
|
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;
|
})) as MiRemoteUser;
|
||||||
|
|
||||||
let _description: string | null = null;
|
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.
|
// We use "!== false" to handle incorrect types, missing / null values, and "default to true" logic.
|
||||||
hideOnlineStatus: person.hideOnlineStatus !== false,
|
hideOnlineStatus: person.hideOnlineStatus !== false,
|
||||||
isExplorable: person.discoverable !== 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(() => ({}))),
|
...(await this.resolveAvatarAndBanner(exist, person.icon, person.image, person.backgroundUrl).catch(() => ({}))),
|
||||||
} as Partial<MiRemoteUser> & Pick<MiRemoteUser, 'isBot' | 'isCat' | 'speakAsCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>;
|
} as Partial<MiRemoteUser> & Pick<MiRemoteUser, 'isBot' | 'isCat' | 'speakAsCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>;
|
||||||
|
|
||||||
|
|
|
@ -390,9 +390,9 @@ export class MiUser {
|
||||||
})
|
})
|
||||||
public allowUnsignedFetch: UserUnsignedFetchOption;
|
public allowUnsignedFetch: UserUnsignedFetchOption;
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('text', {
|
||||||
name: 'attributionDomains',
|
name: 'attributionDomains',
|
||||||
length: 128, array: true, default: '{}',
|
array: true, default: '{}',
|
||||||
})
|
})
|
||||||
public attributionDomains: string[];
|
public attributionDomains: string[];
|
||||||
|
|
||||||
|
|
|
@ -263,9 +263,15 @@ export const paramDef = {
|
||||||
enum: userUnsignedFetchOptions,
|
enum: userUnsignedFetchOptions,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
},
|
},
|
||||||
attributionDomains: { type: 'array', items: {
|
attributionDomains: {
|
||||||
type: 'string',
|
type: 'array',
|
||||||
} },
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
minLength: 1,
|
||||||
|
maxLength: 128,
|
||||||
|
},
|
||||||
|
maxLength: 32,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue