enhance(backend): いくつかのエンドポイントで凍結済みのユーザーが居た場合のエラーを修正 (MisskeyIO#654)
This commit is contained in:
parent
aafa1b291f
commit
5ab83ff9d8
@ -11,6 +11,7 @@ import { QueryService } from '@/core/QueryService.js';
|
|||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['role', 'users'],
|
tags: ['role', 'users'],
|
||||||
@ -92,10 +93,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
.limit(ps.limit)
|
.limit(ps.limit)
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
return await Promise.all(assigns.map(async assign => ({
|
return (await Promise.allSettled(assigns.map(async assign => ({
|
||||||
id: assign.id,
|
id: assign.id,
|
||||||
user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
|
user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
|
||||||
})));
|
}))))
|
||||||
|
.filter((result): result is PromiseFulfilledResult<{ id: string; user: Packed<'UserDetailed'> }> => result.status === 'fulfilled')
|
||||||
|
.map(result => result.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import { GetterService } from '@/server/api/GetterService.js';
|
|||||||
import { CacheService } from '@/core/CacheService.js';
|
import { CacheService } from '@/core/CacheService.js';
|
||||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
import { Packed } from '@/misc/json-schema.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['users'],
|
tags: ['users'],
|
||||||
@ -131,10 +132,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
const topRepliedUsers = repliedUsersSorted.slice(0, ps.limit);
|
const topRepliedUsers = repliedUsersSorted.slice(0, ps.limit);
|
||||||
|
|
||||||
// Make replies object (includes weights)
|
// Make replies object (includes weights)
|
||||||
const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({
|
const repliesObj = (await Promise.allSettled(topRepliedUsers.map(async (user) => ({
|
||||||
user: await this.userEntityService.pack(user, me, { schema: 'UserDetailed' }),
|
user: await this.userEntityService.pack(user, me, { schema: 'UserDetailed' }),
|
||||||
weight: repliedUsers[user] / peak,
|
weight: repliedUsers[user] / peak,
|
||||||
})));
|
}))))
|
||||||
|
.filter((result): result is PromiseFulfilledResult<{ user: Packed<'UserDetailed'>; weight: number }> => result.status === 'fulfilled')
|
||||||
|
.map(result => result.value);
|
||||||
|
|
||||||
return repliesObj;
|
return repliesObj;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user