Merge 849e7ff776
into ce95323e49
This commit is contained in:
commit
a95d78348e
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { ModuleRef } from '@nestjs/core';
|
import { ModuleRef } from '@nestjs/core';
|
||||||
import { In } from 'typeorm';
|
import { EntityNotFoundError, In } from 'typeorm';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { FollowRequestsRepository, NotesRepository, MiUser, UsersRepository } from '@/models/_.js';
|
import type { FollowRequestsRepository, NotesRepository, MiUser, UsersRepository } from '@/models/_.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
|
@ -59,7 +59,6 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
async #packInternal <T extends MiNotification | MiGroupedNotification> (
|
async #packInternal <T extends MiNotification | MiGroupedNotification> (
|
||||||
src: T,
|
src: T,
|
||||||
meId: MiUser['id'],
|
meId: MiUser['id'],
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
options: {
|
options: {
|
||||||
checkValidNotifier?: boolean;
|
checkValidNotifier?: boolean;
|
||||||
},
|
},
|
||||||
|
@ -140,7 +139,10 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
const needsRole = notification.type === 'roleAssigned';
|
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 the role has been deleted, don't show this notification
|
||||||
if (needsRole && !role) {
|
if (needsRole && !role) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -229,7 +231,6 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: MiNotification | MiGroupedNotification,
|
src: MiNotification | MiGroupedNotification,
|
||||||
meId: MiUser['id'],
|
meId: MiUser['id'],
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
options: {
|
options: {
|
||||||
checkValidNotifier?: boolean;
|
checkValidNotifier?: boolean;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue