await more promises to improve stack traces
This commit is contained in:
parent
41d62e4534
commit
05f9d5d446
97 changed files with 143 additions and 127 deletions
|
|
@ -218,9 +218,9 @@ export class AnnouncementService {
|
|||
announcementId: announcement.id,
|
||||
userId: me.id,
|
||||
});
|
||||
return this.announcementEntityService.pack({ ...announcement, isRead: read !== null }, me);
|
||||
return await this.announcementEntityService.pack({ ...announcement, isRead: read !== null }, me);
|
||||
} else {
|
||||
return this.announcementEntityService.pack(announcement, null);
|
||||
return await this.announcementEntityService.pack(announcement, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ export class AntennaService implements OnApplicationShutdown {
|
|||
this.globalEventService.publishAntennaStream(antenna.id, 'note', note);
|
||||
}
|
||||
|
||||
redisPipeline.exec();
|
||||
await redisPipeline.exec();
|
||||
}
|
||||
|
||||
// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ export class AvatarDecorationService implements OnApplicationShutdown {
|
|||
if (noCache) {
|
||||
this.cache.delete();
|
||||
}
|
||||
return this.cache.fetch(() => this.avatarDecorationsRepository.find());
|
||||
return await this.cache.fetch(() => this.avatarDecorationsRepository.find());
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -605,12 +605,12 @@ export class ChatService {
|
|||
|
||||
@bindThis
|
||||
public async findMyRoomById(ownerId: MiUser['id'], roomId: MiChatRoom['id']) {
|
||||
return this.chatRoomsRepository.findOneBy({ id: roomId, ownerId: ownerId });
|
||||
return await this.chatRoomsRepository.findOneBy({ id: roomId, ownerId: ownerId });
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async findRoomById(roomId: MiChatRoom['id']) {
|
||||
return this.chatRoomsRepository.findOne({ where: { id: roomId }, relations: ['owner'] });
|
||||
return await this.chatRoomsRepository.findOne({ where: { id: roomId }, relations: ['owner'] });
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export class ImageProcessingService {
|
|||
*/
|
||||
@bindThis
|
||||
public async convertToWebp(path: string, width: number, height: number, options: sharp.WebpOptions = webpDefault): Promise<IImage> {
|
||||
return this.convertSharpToWebp(sharp(path), width, height, options);
|
||||
return await this.convertSharpToWebp(sharp(path), width, height, options);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -100,7 +100,7 @@ export class ImageProcessingService {
|
|||
*/
|
||||
@bindThis
|
||||
public async convertToAvif(path: string, width: number, height: number, options: sharp.AvifOptions = avifDefault): Promise<IImage> {
|
||||
return this.convertSharpToAvif(sharp(path), width, height, options);
|
||||
return await this.convertSharpToAvif(sharp(path), width, height, options);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -142,7 +142,7 @@ export class ImageProcessingService {
|
|||
*/
|
||||
@bindThis
|
||||
public async convertToPng(path: string, width: number, height: number): Promise<IImage> {
|
||||
return this.convertSharpToPng(sharp(path), width, height);
|
||||
return await this.convertSharpToPng(sharp(path), width, height);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ export class NotificationService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
private postReadAllNotifications(userId: MiUser['id']) {
|
||||
private async postReadAllNotifications(userId: MiUser['id']) {
|
||||
this.globalEventService.publishMainStream(userId, 'readAllNotifications');
|
||||
this.pushNotificationService.pushNotification(userId, 'readAllNotifications', undefined);
|
||||
await this.pushNotificationService.pushNotification(userId, 'readAllNotifications', undefined);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -751,7 +751,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
|||
this.globalEventService.publishRoleTimelineStream(role.id, 'note', note);
|
||||
}
|
||||
|
||||
redisPipeline.exec();
|
||||
await redisPipeline.exec();
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export class S3Service implements OnApplicationShutdown {
|
|||
@bindThis
|
||||
public async upload(input: PutObjectCommandInput) {
|
||||
const client = this.getS3Client();
|
||||
return new Upload({
|
||||
return await new Upload({
|
||||
client,
|
||||
params: input,
|
||||
partSize: (client.config.endpoint && (await client.config.endpoint()).hostname === 'storage.googleapis.com')
|
||||
|
|
|
|||
|
|
@ -256,10 +256,10 @@ export class SearchService {
|
|||
case 'sqlTsvector': {
|
||||
// ほとんど内容に差がないのでsqlLikeとsqlPgroongaを同じ処理にしている.
|
||||
// 今後の拡張で差が出る用であれば関数を分ける.
|
||||
return this.searchNoteByLike(q, me, opts, pagination);
|
||||
return await this.searchNoteByLike(q, me, opts, pagination);
|
||||
}
|
||||
case 'meilisearch': {
|
||||
return this.searchNoteByMeiliSearch(q, me, opts, pagination);
|
||||
return await this.searchNoteByMeiliSearch(q, me, opts, pagination);
|
||||
}
|
||||
default: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
|
|
|||
|
|
@ -94,12 +94,12 @@ export class SponsorsService {
|
|||
@bindThis
|
||||
public async instanceSponsors(forceUpdate: boolean) {
|
||||
if (forceUpdate) await this.cache.refresh('instance');
|
||||
return this.cache.fetch('instance');
|
||||
return await this.cache.fetch('instance');
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async sharkeySponsors(forceUpdate: boolean) {
|
||||
if (forceUpdate) await this.cache.refresh('sharkey');
|
||||
return this.cache.fetch('sharkey');
|
||||
return await this.cache.fetch('sharkey');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export class UserSearchService {
|
|||
}
|
||||
}
|
||||
|
||||
return this.userEntityService.packMany<'UserLite' | 'UserDetailed'>(
|
||||
return await this.userEntityService.packMany<'UserLite' | 'UserDetailed'>(
|
||||
[...resultSet].slice(0, limit),
|
||||
me,
|
||||
{ schema: opts?.detail ? 'UserDetailed' : 'UserLite' },
|
||||
|
|
|
|||
|
|
@ -70,6 +70,6 @@ export class UserService {
|
|||
@bindThis
|
||||
public async notifySystemWebhook(user: MiUser, type: 'userCreated') {
|
||||
const packedUser = await this.userEntityService.pack(user, null, { schema: 'UserLite' });
|
||||
return this.systemWebhookService.enqueueSystemWebhook(type, packedUser);
|
||||
return await this.systemWebhookService.enqueueSystemWebhook(type, packedUser);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ export class UserWebhookService implements OnApplicationShutdown {
|
|||
) {
|
||||
const webhooks = await this.getActiveWebhooks()
|
||||
.then(webhooks => webhooks.filter(webhook => webhook.userId === userId && webhook.on.includes(type)));
|
||||
return Promise.all(
|
||||
return await Promise.all(
|
||||
webhooks.map(webhook => {
|
||||
return this.queueService.userWebhookDeliver(webhook, type, content);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export class JsonLdService {
|
|||
const customLoader = this.getLoader();
|
||||
// XXX: Importing jsonld dynamically since Jest frequently fails to import it statically
|
||||
// https://github.com/misskey-dev/misskey/pull/9894#discussion_r1103753595
|
||||
return (await import('jsonld')).default.compact(data, context, {
|
||||
return await (await import('jsonld')).default.compact(data, context, {
|
||||
documentLoader: customLoader,
|
||||
});
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ export class JsonLdService {
|
|||
@bindThis
|
||||
public async normalize(data: Document): Promise<string> {
|
||||
const customLoader = this.getLoader();
|
||||
return (await import('jsonld')).default.normalize(data, {
|
||||
return await (await import('jsonld')).default.normalize(data, {
|
||||
documentLoader: customLoader,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,8 +329,9 @@ export class ApPersonService implements OnModuleInit {
|
|||
return user;
|
||||
}
|
||||
|
||||
// TODO fix these "any" types
|
||||
private async resolveAvatarAndBanner(user: MiRemoteUser, icon: any, image: any, bgimg: any): Promise<Partial<Pick<MiRemoteUser, 'avatarId' | 'bannerId' | 'backgroundId' | 'avatarUrl' | 'bannerUrl' | 'backgroundUrl' | 'avatarBlurhash' | 'bannerBlurhash' | 'backgroundBlurhash'>>> {
|
||||
const [avatar, banner, background] = await Promise.all([icon, image, bgimg].map(img => {
|
||||
const [avatar, banner, background] = await Promise.all([icon, image, bgimg].map(async img => {
|
||||
// icon and image may be arrays
|
||||
// see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-icon
|
||||
if (Array.isArray(img)) {
|
||||
|
|
@ -343,7 +344,7 @@ export class ApPersonService implements OnModuleInit {
|
|||
return { id: null, url: null, blurhash: null };
|
||||
}
|
||||
|
||||
return this.apImageService.resolveImage(user, img).catch(() => null);
|
||||
return await this.apImageService.resolveImage(user, img).catch(() => null);
|
||||
}));
|
||||
|
||||
if (((avatar != null && avatar.id != null) || (banner != null && banner.id != null))
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export class BlockingEntityService {
|
|||
): Promise<Packed<'Blocking'>> {
|
||||
const blocking = typeof src === 'object' ? src : await this.blockingsRepository.findOneByOrFail({ id: src });
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: blocking.id,
|
||||
createdAt: this.idService.parse(blocking.id).date.toISOString(),
|
||||
|
|
@ -53,6 +54,6 @@ export class BlockingEntityService {
|
|||
const _blockees = blockings.map(({ blockee, blockeeId }) => blockee ?? blockeeId);
|
||||
const _userMap = await this.userEntityService.packMany(_blockees, me, { schema: 'UserDetailedNotMe' })
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(blockings.map(blocking => this.pack(blocking, me, { blockee: _userMap.get(blocking.blockeeId) })));
|
||||
return await Promise.all(blockings.map(blocking => this.pack(blocking, me, { blockee: _userMap.get(blocking.blockeeId) })));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ export class ChatEntityService {
|
|||
.then(rooms => new Map(rooms.map(r => [r.id, r]))),
|
||||
]);
|
||||
|
||||
return Promise.all(messages.map(message => this.packMessageDetailed(message, me, { _hint_: { packedUsers, packedFiles, packedRooms } })));
|
||||
return await Promise.all(messages.map(message => this.packMessageDetailed(message, me, { _hint_: { packedUsers, packedFiles, packedRooms } })));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -165,7 +165,7 @@ export class ChatEntityService {
|
|||
.then(files => new Map(files.map(f => [f.id, f]))),
|
||||
]);
|
||||
|
||||
return Promise.all(messages.map(message => this.packMessageLiteFor1on1(message, { _hint_: { packedFiles } })));
|
||||
return await Promise.all(messages.map(message => this.packMessageLiteFor1on1(message, { _hint_: { packedFiles } })));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -228,7 +228,7 @@ export class ChatEntityService {
|
|||
.then(files => new Map(files.map(f => [f.id, f]))),
|
||||
]);
|
||||
|
||||
return Promise.all(messages.map(message => this.packMessageLiteForRoom(message, { _hint_: { packedFiles, packedUsers } })));
|
||||
return await Promise.all(messages.map(message => this.packMessageLiteForRoom(message, { _hint_: { packedFiles, packedUsers } })));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -289,7 +289,7 @@ export class ChatEntityService {
|
|||
}).then(memberships => new Map(_rooms.map(r => [r.id, memberships.find(m => m.roomId === r.id)]))),
|
||||
]);
|
||||
|
||||
return Promise.all(_rooms.map(room => this.packRoom(room, me, { _hint_: { packedOwners, memberships } })));
|
||||
return await Promise.all(_rooms.map(room => this.packRoom(room, me, { _hint_: { packedOwners, memberships } })));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -322,7 +322,7 @@ export class ChatEntityService {
|
|||
) {
|
||||
if (invitations.length === 0) return [];
|
||||
|
||||
return Promise.all(invitations.map(invitation => this.packRoomInvitation(invitation, me)));
|
||||
return await Promise.all(invitations.map(invitation => this.packRoomInvitation(invitation, me)));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
@ -371,6 +371,6 @@ export class ChatEntityService {
|
|||
.then(rooms => new Map(rooms.map(r => [r.id, r]))),
|
||||
]);
|
||||
|
||||
return Promise.all(memberships.map(membership => this.packRoomMembership(membership, me, { ...options, _hint_: { packedUsers, packedRooms } })));
|
||||
return await Promise.all(memberships.map(membership => this.packRoomMembership(membership, me, { ...options, _hint_: { packedUsers, packedRooms } })));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ export class ClipEntityService {
|
|||
const meId = me ? me.id : null;
|
||||
const clip = typeof src === 'object' ? src : await this.clipsRepository.findOneByOrFail({ id: src });
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: clip.id,
|
||||
createdAt: this.idService.parse(clip.id).date.toISOString(),
|
||||
|
|
@ -65,7 +66,7 @@ export class ClipEntityService {
|
|||
const _users = clips.map(({ user, userId }) => user ?? userId);
|
||||
const _userMap = await this.userEntityService.packMany(_users, me)
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(clips.map(clip => this.pack(clip, me, { packedUser: _userMap.get(clip.userId) })));
|
||||
return await Promise.all(clips.map(clip => this.pack(clip, me, { packedUser: _userMap.get(clip.userId) })));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ export class DriveFileEntityService implements OnModuleInit {
|
|||
|
||||
const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneByOrFail({ id: src });
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll<Packed<'DriveFile'>>({
|
||||
id: file.id,
|
||||
createdAt: this.idService.parse(file.id).date.toISOString(),
|
||||
|
|
@ -239,6 +240,7 @@ export class DriveFileEntityService implements OnModuleInit {
|
|||
const file = typeof src === 'object' ? src : await this.driveFilesRepository.findOneBy({ id: src });
|
||||
if (file == null) return null;
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll<Packed<'DriveFile'>>({
|
||||
id: file.id,
|
||||
createdAt: this.idService.parse(file.id).date.toISOString(),
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ export class EmojiEntityService implements OnModuleInit {
|
|||
hintRoles = new Map(roles.map(x => [x.id, x]));
|
||||
}
|
||||
|
||||
return Promise.all(emojis.map(x => this.packDetailedAdmin(x, { roles: hintRoles })));
|
||||
return await Promise.all(emojis.map(x => this.packDetailedAdmin(x, { roles: hintRoles })));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export class FlashEntityService {
|
|||
.getRawMany<{ flashLike_flashId: string }>()
|
||||
.then(likes => [...new Set(likes.map(like => like.flashLike_flashId))])
|
||||
: [];
|
||||
return Promise.all(
|
||||
return await Promise.all(
|
||||
flashes.map(flash => this.pack(flash, me, {
|
||||
packedUser: _userMap.get(flash.userId),
|
||||
likedFlashIds: _likedFlashIds,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export class FollowRequestEntityService {
|
|||
const _followees = requests.map(({ followee, followeeId }) => followee ?? followeeId);
|
||||
const _userMap = await this.userEntityService.packMany([..._followers, ..._followees], me)
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(
|
||||
return await Promise.all(
|
||||
requests.map(req => {
|
||||
const packedFollower = _userMap.get(req.followerId);
|
||||
const packedFollowee = _userMap.get(req.followeeId);
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ export class FollowingEntityService {
|
|||
|
||||
if (opts == null) opts = {};
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: following.id,
|
||||
createdAt: this.idService.parse(following.id).date.toISOString(),
|
||||
|
|
@ -166,7 +167,7 @@ export class FollowingEntityService {
|
|||
const _followers = opts?.populateFollower ? followings.map(({ follower, followerId }) => follower ?? followerId) : [];
|
||||
const _userMap = await this.userEntityService.packMany([..._followees, ..._followers], me, { schema: 'UserDetailedNotMe' })
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(
|
||||
return await Promise.all(
|
||||
followings.map(following => {
|
||||
const packedFollowee = opts?.populateFollowee ? _userMap.get(following.followeeId) : undefined;
|
||||
const packedFollower = opts?.populateFollower ? _userMap.get(following.followerId) : undefined;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ export class GalleryPostEntityService {
|
|||
const meId = me ? me.id : null;
|
||||
const post = typeof src === 'object' ? src : await this.galleryPostsRepository.findOneByOrFail({ id: src });
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: post.id,
|
||||
createdAt: this.idService.parse(post.id).date.toISOString(),
|
||||
|
|
@ -68,7 +69,7 @@ export class GalleryPostEntityService {
|
|||
const _users = posts.map(({ user, userId }) => user ?? userId);
|
||||
const _userMap = await this.userEntityService.packMany(_users, me)
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(posts.map(post => this.pack(post, me, { packedUser: _userMap.get(post.userId) })));
|
||||
return await Promise.all(posts.map(post => this.pack(post, me, { packedUser: _userMap.get(post.userId) })));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export class InviteCodeEntityService {
|
|||
const _usedBys = tickets.map(({ usedBy, usedById }) => usedBy ?? usedById).filter(x => x != null);
|
||||
const _userMap = await this.userEntityService.packMany([..._createdBys, ..._usedBys], me)
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(
|
||||
return await Promise.all(
|
||||
tickets.map(ticket => {
|
||||
const packedCreatedBy = ticket.createdById != null ? _userMap.get(ticket.createdById) : undefined;
|
||||
const packedUsedBy = ticket.usedById != null ? _userMap.get(ticket.usedById) : undefined;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ export class ModerationLogEntityService {
|
|||
) {
|
||||
const log = typeof src === 'object' ? src : await this.moderationLogsRepository.findOneByOrFail({ id: src });
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: log.id,
|
||||
createdAt: this.idService.parse(log.id).date.toISOString(),
|
||||
|
|
@ -53,7 +54,7 @@ export class ModerationLogEntityService {
|
|||
const _users = reports.map(({ user, userId }) => user ?? userId);
|
||||
const _userMap = await this.userEntityService.packMany(_users, null, { schema: 'UserDetailedNotMe' })
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(reports.map(report => this.pack(report, { packedUser: _userMap.get(report.userId) })));
|
||||
return await Promise.all(reports.map(report => this.pack(report, { packedUser: _userMap.get(report.userId) })));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export class MutingEntityService {
|
|||
): Promise<Packed<'Muting'>> {
|
||||
const muting = typeof src === 'object' ? src : await this.mutingsRepository.findOneByOrFail({ id: src });
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: muting.id,
|
||||
createdAt: this.idService.parse(muting.id).date.toISOString(),
|
||||
|
|
@ -55,7 +56,7 @@ export class MutingEntityService {
|
|||
const _mutees = mutings.map(({ mutee, muteeId }) => mutee ?? muteeId);
|
||||
const _userMap = await this.userEntityService.packMany(_mutees, me, { schema: 'UserDetailedNotMe' })
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(mutings.map(muting => this.pack(muting, me, { packedMutee: _userMap.get(muting.muteeId) })));
|
||||
return await Promise.all(mutings.map(muting => this.pack(muting, me, { packedMutee: _userMap.get(muting.muteeId) })));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -592,6 +592,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||
|
||||
const bypassSilence = opts.bypassSilence || note.userId === meId;
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
const packed: Packed<'Note'> = await awaitAll({
|
||||
id: note.id,
|
||||
threadId,
|
||||
|
|
|
|||
|
|
@ -88,6 +88,6 @@ export class NoteReactionEntityService implements OnModuleInit {
|
|||
const _users = reactions.map(({ user, userId }) => user ?? userId);
|
||||
const _userMap = await this.userEntityService.packMany(_users, me)
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(reactions.map(reaction => this.pack(reaction, me, opts, { packedUser: _userMap.get(reaction.userId) })));
|
||||
return await Promise.all(reactions.map(reaction => this.pack(reaction, me, opts, { packedUser: _userMap.get(reaction.userId) })));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,11 +83,12 @@ export class PageEntityService {
|
|||
};
|
||||
migrate(page.content);
|
||||
if (migrated) {
|
||||
this.pagesRepository.update(page.id, {
|
||||
await this.pagesRepository.update(page.id, {
|
||||
content: page.content,
|
||||
});
|
||||
}
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: page.id,
|
||||
createdAt: this.idService.parse(page.id).date.toISOString(),
|
||||
|
|
@ -119,7 +120,7 @@ export class PageEntityService {
|
|||
const _users = pages.map(({ user, userId }) => user ?? userId);
|
||||
const _userMap = await this.userEntityService.packMany(_users, me)
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(pages.map(page => this.pack(page, me, { packedUser: _userMap.get(page.userId) })));
|
||||
return await Promise.all(pages.map(page => this.pack(page, me, { packedUser: _userMap.get(page.userId) })));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export class RenoteMutingEntityService {
|
|||
): Promise<Packed<'RenoteMuting'>> {
|
||||
const muting = typeof src === 'object' ? src : await this.renoteMutingsRepository.findOneByOrFail({ id: src });
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
return await awaitAll({
|
||||
id: muting.id,
|
||||
createdAt: this.idService.parse(muting.id).date.toISOString(),
|
||||
|
|
@ -54,7 +55,7 @@ export class RenoteMutingEntityService {
|
|||
const _users = mutings.map(({ mutee, muteeId }) => mutee ?? muteeId);
|
||||
const _userMap = await this.userEntityService.packMany(_users, me, { schema: 'UserDetailedNotMe' })
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(mutings.map(muting => this.pack(muting, me, { packedMutee: _userMap.get(muting.muteeId) })));
|
||||
return await Promise.all(mutings.map(muting => this.pack(muting, me, { packedMutee: _userMap.get(muting.muteeId) })));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
if (user.avatarId != null && user.avatarUrl === null) {
|
||||
const avatar = await this.driveFilesRepository.findOneByOrFail({ id: user.avatarId });
|
||||
user.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar');
|
||||
this.usersRepository.update(user.id, {
|
||||
await this.usersRepository.update(user.id, {
|
||||
avatarUrl: user.avatarUrl,
|
||||
avatarBlurhash: avatar.blurhash,
|
||||
});
|
||||
|
|
@ -493,7 +493,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
if (user.bannerId != null && user.bannerUrl === null) {
|
||||
const banner = await this.driveFilesRepository.findOneByOrFail({ id: user.bannerId });
|
||||
user.bannerUrl = this.driveFileEntityService.getPublicUrl(banner);
|
||||
this.usersRepository.update(user.id, {
|
||||
await this.usersRepository.update(user.id, {
|
||||
bannerUrl: user.bannerUrl,
|
||||
bannerBlurhash: banner.blurhash,
|
||||
});
|
||||
|
|
@ -501,7 +501,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
if (user.backgroundId != null && user.backgroundUrl === null) {
|
||||
const background = await this.driveFilesRepository.findOneByOrFail({ id: user.backgroundId });
|
||||
user.backgroundUrl = this.driveFileEntityService.getPublicUrl(background);
|
||||
this.usersRepository.update(user.id, {
|
||||
await this.usersRepository.update(user.id, {
|
||||
backgroundUrl: user.backgroundUrl,
|
||||
backgroundBlurhash: background.blurhash,
|
||||
});
|
||||
|
|
@ -581,6 +581,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
|
||||
const bypassSilence = isMe || (myFollowings ? myFollowings.has(user.id) : false);
|
||||
|
||||
// noinspection ES6MissingAwait
|
||||
const packed = {
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
|
|
@ -894,7 +895,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
myFollowingsPromise,
|
||||
]);
|
||||
|
||||
return Promise.all(
|
||||
return await Promise.all(
|
||||
_users.map(u => this.pack(
|
||||
u,
|
||||
me,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export class UserListEntityService {
|
|||
const _users = memberships.map(({ user, userId }) => user ?? userId);
|
||||
const _userMap = await this.userEntityService.packMany(_users)
|
||||
.then(users => new Map(users.map(u => [u.id, u])));
|
||||
return Promise.all(memberships.map(async x => ({
|
||||
return await Promise.all(memberships.map(async x => ({
|
||||
id: x.id,
|
||||
createdAt: this.idService.parse(x.id).date.toISOString(),
|
||||
userId: x.userId,
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ export class ImportNotesProcessorService {
|
|||
const hashtags = extractApHashtagObjects(toot.object.tag).map((x) => x.name).filter((x): x is string => x != null);
|
||||
|
||||
try {
|
||||
text = await this.mfmService.fromHtml(toot.object.content, hashtags);
|
||||
text = this.mfmService.fromHtml(toot.object.content, hashtags);
|
||||
} catch (error) {
|
||||
text = undefined;
|
||||
}
|
||||
|
|
@ -487,7 +487,7 @@ export class ImportNotesProcessorService {
|
|||
const hashtags = extractApHashtagObjects(post.object.tag).map((x) => x.name).filter((x): x is string => x != null);
|
||||
|
||||
try {
|
||||
text = await this.mfmService.fromHtml(post.object.content, hashtags);
|
||||
text = this.mfmService.fromHtml(post.object.content, hashtags);
|
||||
} catch (error) {
|
||||
text = undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,11 +145,11 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public handleRequest(
|
||||
public async handleRequest(
|
||||
endpoint: IEndpoint & { exec: any },
|
||||
request: FastifyRequest<{ Body: Record<string, unknown> | undefined, Querystring: Record<string, unknown> }>,
|
||||
reply: FastifyReply,
|
||||
): void {
|
||||
): Promise<void> {
|
||||
// Tell crawlers not to index API endpoints.
|
||||
// https://developers.google.com/search/docs/crawling-indexing/block-indexing
|
||||
reply.header('X-Robots-Tag', 'noindex');
|
||||
|
|
@ -166,8 +166,8 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
reply.code(400);
|
||||
return;
|
||||
}
|
||||
this.authenticateService.authenticate(token).then(([user, app]) => {
|
||||
this.call(endpoint, user, app, body, null, request, reply).then((res) => {
|
||||
await this.authenticateService.authenticate(token).then(async ([user, app]) => {
|
||||
await this.call(endpoint, user, app, body, null, request, reply).then((res) => {
|
||||
if (request.method === 'GET' && endpoint.meta.cacheSec && !token && !user) {
|
||||
reply.header('Cache-Control', `public, max-age=${endpoint.meta.cacheSec}`);
|
||||
}
|
||||
|
|
@ -177,7 +177,8 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
});
|
||||
|
||||
if (user) {
|
||||
this.logIp(request, user);
|
||||
// logIp records errors directly
|
||||
this.logIp(request, user).catch(() => null);
|
||||
}
|
||||
}).catch(err => {
|
||||
this.#sendAuthenticationError(reply, err);
|
||||
|
|
@ -225,8 +226,8 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
reply.code(400);
|
||||
return;
|
||||
}
|
||||
this.authenticateService.authenticate(token).then(([user, app]) => {
|
||||
this.call(endpoint, user, app, fields, {
|
||||
await this.authenticateService.authenticate(token).then(async ([user, app]) => {
|
||||
await this.call(endpoint, user, app, fields, {
|
||||
name: multipartData.filename,
|
||||
path: path,
|
||||
}, request, reply).then((res) => {
|
||||
|
|
@ -237,7 +238,8 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
});
|
||||
|
||||
if (user) {
|
||||
this.logIp(request, user);
|
||||
// logIp records errors directly
|
||||
this.logIp(request, user).catch(() => null);
|
||||
}
|
||||
}).catch(err => {
|
||||
cleanup();
|
||||
|
|
@ -268,7 +270,7 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
private logIp(request: FastifyRequest, user: MiLocalUser) {
|
||||
private async logIp(request: FastifyRequest, user: MiLocalUser) {
|
||||
if (!this.meta.enableIpLogging) return;
|
||||
const ip = request.ip;
|
||||
if (!ip) {
|
||||
|
|
@ -285,12 +287,13 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
try {
|
||||
this.userIpsRepository.createQueryBuilder().insert().values({
|
||||
await this.userIpsRepository.createQueryBuilder().insert().values({
|
||||
createdAt: this.timeService.date,
|
||||
userId: user.id,
|
||||
ip: ip,
|
||||
}).orIgnore(true).execute();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
this.logger.warn(`Failed to save IP address ${ip} for user ${user.id}: ${renderInlineError(err)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ export class ApiServerService {
|
|||
});
|
||||
|
||||
if (token && token.session != null && !token.fetched) {
|
||||
this.accessTokensRepository.update(token.id, {
|
||||
await this.accessTokensRepository.update(token.id, {
|
||||
fetched: true,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ export class SigninApiService {
|
|||
if (same) {
|
||||
if (profile.password!.startsWith('$2')) {
|
||||
const newHash = await argon2.hash(password);
|
||||
this.userProfilesRepository.update(user.id, {
|
||||
await this.userProfilesRepository.update(user.id, {
|
||||
password: newHash,
|
||||
});
|
||||
}
|
||||
|
|
@ -267,7 +267,7 @@ export class SigninApiService {
|
|||
try {
|
||||
if (profile.password!.startsWith('$2')) {
|
||||
const newHash = await argon2.hash(password);
|
||||
this.userProfilesRepository.update(user.id, {
|
||||
await this.userProfilesRepository.update(user.id, {
|
||||
password: newHash,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
me,
|
||||
);
|
||||
|
||||
return this.abuseReportNotificationRecipientEntityService.pack(result);
|
||||
return await this.abuseReportNotificationRecipientEntityService.pack(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
) {
|
||||
super(meta, paramDef, async (ps) => {
|
||||
const recipients = await this.abuseReportNotificationService.fetchRecipients({ method: ps.method });
|
||||
return this.abuseReportNotificationRecipientEntityService.packMany(recipients);
|
||||
return await this.abuseReportNotificationRecipientEntityService.packMany(recipients);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchRecipient);
|
||||
}
|
||||
|
||||
return this.abuseReportNotificationRecipientEntityService.pack(recipients[0]);
|
||||
return await this.abuseReportNotificationRecipientEntityService.pack(recipients[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
me,
|
||||
);
|
||||
|
||||
return this.abuseReportNotificationRecipientEntityService.pack(result);
|
||||
return await this.abuseReportNotificationRecipientEntityService.pack(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private captchaService: CaptchaService,
|
||||
) {
|
||||
super(meta, paramDef, async () => {
|
||||
return this.captchaService.get();
|
||||
return await this.captchaService.get();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
|
||||
for (const file of files) {
|
||||
this.driveService.deleteFile(file);
|
||||
await this.driveService.deleteFile(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
|
||||
for (const file of files) {
|
||||
this.driveService.deleteFile(file);
|
||||
await this.driveService.deleteFile(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
roleIdsThatCanBeUsedThisEmojiAsReaction: ps.roleIdsThatCanBeUsedThisEmojiAsReaction ?? [],
|
||||
}, me);
|
||||
|
||||
return this.emojiEntityService.packDetailed(emoji);
|
||||
return await this.emojiEntityService.packDetailed(emoji);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
roleIdsThatCanBeUsedThisEmojiAsReaction: emoji.roleIdsThatCanBeUsedThisEmojiAsReaction,
|
||||
}, me);
|
||||
|
||||
return this.emojiEntityService.packDetailed(addedEmoji);
|
||||
return await this.emojiEntityService.packDetailed(addedEmoji);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return this.emojiEntityService.packDetailedMany(emojis);
|
||||
return await this.emojiEntityService.packDetailedMany(emojis);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
emojis = await q.take(ps.limit).skip(ps.offset ?? 0).getMany();
|
||||
}
|
||||
|
||||
return this.emojiEntityService.packDetailedMany(emojis);
|
||||
return await this.emojiEntityService.packDetailedMany(emojis);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
|
||||
for (const file of files) {
|
||||
this.driveService.deleteFile(file);
|
||||
await this.driveService.deleteFile(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new Error('instance not found');
|
||||
}
|
||||
|
||||
this.fetchInstanceMetadataService.fetchInstanceMetadata(instance, true);
|
||||
await this.fetchInstanceMetadataService.fetchInstanceMetadata(instance, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
host: ps.host,
|
||||
});
|
||||
|
||||
this.queueService.createUnfollowJob(pairs.map(p => ({ from: p[0], to: p[1], silent: true })));
|
||||
await this.queueService.createUnfollowJob(pairs.map(p => ({ from: p[0], to: p[1], silent: true })));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.queueClear(ps.queue, ps.state);
|
||||
await this.queueService.queueClear(ps.queue, ps.state);
|
||||
|
||||
this.moderationLogService.log(me, 'clearQueue');
|
||||
await this.moderationLogService.log(me, 'clearQueue');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.queueService.queueGetJobs(ps.queue, ps.state, ps.search);
|
||||
return await this.queueService.queueGetJobs(ps.queue, ps.state, ps.search);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.queuePromoteJobs(ps.queue);
|
||||
await this.queueService.queuePromoteJobs(ps.queue);
|
||||
|
||||
this.moderationLogService.log(me, 'promoteQueue');
|
||||
await this.moderationLogService.log(me, 'promoteQueue');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.queueService.queueGetQueue(ps.queue);
|
||||
return await this.queueService.queueGetQueue(ps.queue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.queueService.queueGetQueues();
|
||||
return await this.queueService.queueGetQueues();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.queueRemoveJob(ps.queue, ps.jobId);
|
||||
await this.queueService.queueRemoveJob(ps.queue, ps.jobId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.queueRetryJob(ps.queue, ps.jobId);
|
||||
await this.queueService.queueRetryJob(ps.queue, ps.jobId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.queueService.queueGetJob(ps.queue, ps.jobId);
|
||||
return await this.queueService.queueGetJob(ps.queue, ps.jobId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
me,
|
||||
);
|
||||
|
||||
return this.systemWebhookEntityService.pack(result);
|
||||
return await this.systemWebhookEntityService.pack(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
isActive: ps.isActive,
|
||||
on: ps.on,
|
||||
});
|
||||
return this.systemWebhookEntityService.packMany(webhooks);
|
||||
return await this.systemWebhookEntityService.packMany(webhooks);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchSystemWebhook);
|
||||
}
|
||||
|
||||
return this.systemWebhookEntityService.pack(webhooks[0]);
|
||||
return await this.systemWebhookEntityService.pack(webhooks[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
me,
|
||||
);
|
||||
|
||||
return this.systemWebhookEntityService.pack(result);
|
||||
return await this.systemWebhookEntityService.pack(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const announcements = await query.limit(ps.limit).getMany();
|
||||
|
||||
return this.announcementEntityService.packMany(announcements, me);
|
||||
return await this.announcementEntityService.packMany(announcements, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
});
|
||||
|
||||
// Delete session
|
||||
this.authSessionsRepository.delete(session.id);
|
||||
await this.authSessionsRepository.delete(session.id);
|
||||
|
||||
return {
|
||||
accessToken: accessToken.token,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (message.fromUserId !== me.id && message.toUserId !== me.id && !(await this.roleService.isModerator(me))) {
|
||||
throw new ApiError(meta.errors.noSuchMessage);
|
||||
}
|
||||
return this.chatEntityService.packMessageDetailed(message, me);
|
||||
return await this.chatEntityService.packMessageDetailed(message, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
await this.chatService.checkChatAvailability(me.id, 'read');
|
||||
|
||||
const invitations = await this.chatService.getReceivedRoomInvitationsWithPagination(me.id, ps.limit, ps.sinceId, ps.untilId);
|
||||
return this.chatEntityService.packRoomInvitations(invitations, me);
|
||||
return await this.chatEntityService.packRoomInvitations(invitations, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
const invitations = await this.chatService.getSentRoomInvitationsWithPagination(ps.roomId, ps.limit, ps.sinceId, ps.untilId);
|
||||
return this.chatEntityService.packRoomInvitations(invitations, me);
|
||||
return await this.chatEntityService.packRoomInvitations(invitations, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const memberships = await this.chatService.getMyMemberships(me.id, ps.limit, ps.sinceId, ps.untilId);
|
||||
|
||||
return this.chatEntityService.packRoomMemberships(memberships, me, {
|
||||
return await this.chatEntityService.packRoomMemberships(memberships, me, {
|
||||
populateUser: false,
|
||||
populateRoom: true,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const memberships = await this.chatService.getRoomMembershipsWithPagination(room.id, ps.limit, ps.sinceId, ps.untilId);
|
||||
|
||||
return this.chatEntityService.packRoomMemberships(memberships, me, {
|
||||
return await this.chatEntityService.packRoomMemberships(memberships, me, {
|
||||
populateUser: true,
|
||||
populateRoom: false,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
await this.chatService.checkChatAvailability(me.id, 'read');
|
||||
|
||||
const rooms = await this.chatService.getOwnedRoomsWithPagination(me.id, ps.limit, ps.sinceId, ps.untilId);
|
||||
return this.chatEntityService.packRooms(rooms, me);
|
||||
return await this.chatEntityService.packRooms(rooms, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchRoom);
|
||||
}
|
||||
|
||||
return this.chatEntityService.packRoom(room, me);
|
||||
return await this.chatEntityService.packRoom(room, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
description: ps.description,
|
||||
});
|
||||
|
||||
return this.chatEntityService.packRoom(updated, me);
|
||||
return await this.chatEntityService.packRoom(updated, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const favorites = await query
|
||||
.getMany();
|
||||
|
||||
return this.clipEntityService.packMany(favorites.map(x => x.clip!), me);
|
||||
return await this.clipEntityService.packMany(favorites.map(x => x.clip!), me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
// Update
|
||||
this.driveFoldersRepository.update(folder.id, {
|
||||
await this.driveFoldersRepository.update(folder.id, {
|
||||
name: folder.name,
|
||||
parentId: folder.parentId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
super(meta, paramDef, async (ps, me) => {
|
||||
const emoji = await this.customEmojiService.emojisByKeyCache.fetch(ps.name);
|
||||
|
||||
return this.emojiEntityService.packDetailed(emoji);
|
||||
return await this.emojiEntityService.packDetailed(emoji);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportCustomEmojisJob(me);
|
||||
await this.queueService.createExportCustomEmojisJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private followingEntityService: FollowingEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.followingEntityService.getFollowers(me, ps);
|
||||
return await this.followingEntityService.getFollowers(me, ps);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private followingEntityService: FollowingEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
return this.followingEntityService.getFollowing(me, ps);
|
||||
return await this.followingEntityService.getFollowing(me, ps);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return this.flashLikeEntityService.packMany(likes, me);
|
||||
return await this.flashLikeEntityService.packMany(likes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
const tags = await query.limit(ps.limit).getMany();
|
||||
|
||||
return this.hashtagEntityService.packMany(tags);
|
||||
return await this.hashtagEntityService.packMany(tags);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportAntennasJob(me);
|
||||
await this.queueService.createExportAntennasJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportBlockingJob(me);
|
||||
await this.queueService.createExportBlockingJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportClipsJob(me);
|
||||
await this.queueService.createExportClipsJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportAccountDataJob(me);
|
||||
await this.queueService.createExportAccountDataJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportFavoritesJob(me);
|
||||
await this.queueService.createExportFavoritesJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportFollowingJob(me, ps.excludeMuting, ps.excludeInactive);
|
||||
await this.queueService.createExportFollowingJob(me, ps.excludeMuting, ps.excludeInactive);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportMuteJob(me);
|
||||
await this.queueService.createExportMuteJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportNotesJob(me);
|
||||
await this.queueService.createExportNotesJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private queueService: QueueService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.queueService.createExportUserListsJob(me);
|
||||
await this.queueService.createExportUserListsJob(me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return this.pageLikeEntityService.packMany(likes, me);
|
||||
return await this.pageLikeEntityService.packMany(likes, me);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const note = await this.notesRepository.findOneBy({ id });
|
||||
if (note) {
|
||||
note.reactionAndUserPairCache ??= [];
|
||||
return this.noteEntityService.pack(note, me);
|
||||
return await this.noteEntityService.pack(note, me);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private notificationService: NotificationService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.notificationService.flushAllNotifications(me.id);
|
||||
await this.notificationService.flushAllNotifications(me.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private notificationService: NotificationService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
this.notificationService.readAllNotification(me.id, true);
|
||||
await this.notificationService.readAllNotification(me.id, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
password: hash,
|
||||
});
|
||||
|
||||
this.passwordResetRequestsRepository.delete(req.id);
|
||||
await this.passwordResetRequestsRepository.delete(req.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return this.userListEntityService.packMembershipsMany(memberships);
|
||||
return await this.userListEntityService.packMembershipsMany(memberships);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ export class MastodonConverters {
|
|||
|
||||
const bioText = profile?.description && this.mfmService.toMastoApiHtml(mfm.parse(profile.description));
|
||||
|
||||
return awaitAll({
|
||||
return await awaitAll({
|
||||
id: account.id,
|
||||
username: user.username,
|
||||
acct: acct,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue