Compare commits

...

5 Commits

Author SHA1 Message Date
HinanoAira a95d78348e
Merge 849e7ff776 into ce95323e49 2024-09-17 22:10:12 +09:00
かっこかり ce95323e49
fix(antenna): src=list && userListId=null の場合クエリータイムアウトが発生する問題を修正 (MisskeyIO#721) (#14568)
(cherry picked from commit 47b6b97c9c6d9583dd1b11acbf8f94059e81ebaf)

Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
2024-09-17 22:02:34 +09:00
HinanoAira 849e7ff776
Merge branch 'develop' into hinanoaira/fix-role-not-found-exception 2024-09-09 21:21:05 +09:00
HinanoAira 8b0f3e7fa5
fix: エラーハンドリングでの保守性の確保
- catchブロックでのeという変数名は混同の危険性があるため利用しない
- 保守性のため型チェックでのエラーハンドリングを行う
2024-09-08 04:11:22 +09:00
HinanoAira 41f65a20f1
fix: 通知からロール参照時にロールが存在しないときの例外処理を追加 2024-09-05 23:34:41 +09:00
2 changed files with 13 additions and 9 deletions

View File

@ -123,11 +123,14 @@ export class AntennaService implements OnApplicationShutdown {
if (antenna.src === 'home') {
// TODO
} else if (antenna.src === 'list') {
const listUsers = (await this.userListMembershipsRepository.findBy({
userListId: antenna.userListId!,
})).map(x => x.userId);
if (!listUsers.includes(note.userId)) return false;
if (antenna.userListId == null) return false;
const exists = await this.userListMembershipsRepository.exists({
where: {
userListId: antenna.userListId,
userId: note.userId,
},
});
if (!exists) return false;
} else if (antenna.src === 'users') {
const accts = antenna.users.map(x => {
const { username, host } = Acct.parse(x);

View File

@ -5,7 +5,7 @@
import { Inject, Injectable } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { In } from 'typeorm';
import { EntityNotFoundError, In } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { FollowRequestsRepository, NotesRepository, MiUser, UsersRepository } from '@/models/_.js';
import { awaitAll } from '@/misc/prelude/await-all.js';
@ -59,7 +59,6 @@ export class NotificationEntityService implements OnModuleInit {
async #packInternal <T extends MiNotification | MiGroupedNotification> (
src: T,
meId: MiUser['id'],
// eslint-disable-next-line @typescript-eslint/ban-types
options: {
checkValidNotifier?: boolean;
},
@ -140,7 +139,10 @@ export class NotificationEntityService implements OnModuleInit {
// #endregion
const needsRole = notification.type === 'roleAssigned';
const role = needsRole ? await this.roleEntityService.pack(notification.roleId) : undefined;
const role = needsRole ? await this.roleEntityService.pack(notification.roleId).catch((err) => {
if (err instanceof EntityNotFoundError) return null;
throw err;
}) : undefined;
// if the role has been deleted, don't show this notification
if (needsRole && !role) {
return null;
@ -229,7 +231,6 @@ export class NotificationEntityService implements OnModuleInit {
public async pack(
src: MiNotification | MiGroupedNotification,
meId: MiUser['id'],
// eslint-disable-next-line @typescript-eslint/ban-types
options: {
checkValidNotifier?: boolean;
},