feat: 凍結されたユーザーのコンテンツを見えないようにする (MisskeyIO#134)
ついでにEntityServiceの型定義、meのoptionalをやめる
This commit is contained in:
parent
3b73874196
commit
7f0acd3ea4
70 changed files with 742 additions and 325 deletions
|
|
@ -21,7 +21,7 @@ export class InviteCodeEntityService {
|
|||
@bindThis
|
||||
public async pack(
|
||||
src: RegistrationTicket['id'] | RegistrationTicket,
|
||||
me?: { id: User['id'] } | null | undefined,
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
): Promise<Packed<'InviteCode'>> {
|
||||
const target = typeof src === 'object' ? src : await this.registrationTicketsRepository.findOneOrFail({
|
||||
where: {
|
||||
|
|
@ -43,10 +43,12 @@ export class InviteCodeEntityService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public packMany(
|
||||
targets: any[],
|
||||
me: { id: User['id'] },
|
||||
) {
|
||||
return Promise.all(targets.map(x => this.pack(x, me)));
|
||||
public async packMany(
|
||||
targets: (RegistrationTicket['id'] | RegistrationTicket)[],
|
||||
me: { id: User['id'] } | null | undefined,
|
||||
) : Promise<Packed<'InviteCode'>[]> {
|
||||
return (await Promise.allSettled(targets.map(x => this.pack(x, me))))
|
||||
.filter(result => result.status === 'fulfilled')
|
||||
.map(result => (result as PromiseFulfilledResult<Packed<'InviteCode'>>).value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue