diff --git a/CHANGELOG.md b/CHANGELOG.md index a9e435a6a..cbda1f194 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ - Fix: `hashtags/trend`にてRedisからトレンドの情報が取得できない際にInternal Server Errorになる問題を修正 - Fix: HTLをリロードまたは遡行したとき、フォローしているチャンネルのノートが含まれない問題を修正 #11765 #12181 - Fix: リノートをリノートできるのを修正 +- Fix: アクセストークンを削除すると、通知が取得できなくなる場合がある問題を修正 ## 2023.10.2 diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index 3ee7c91f3..9542815bd 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; import { In } from 'typeorm'; import { DI } from '@/di-symbols.js'; -import type { AccessTokensRepository, 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 type { MiNotification } from '@/models/Notification.js'; import type { MiNote } from '@/models/Note.js'; @@ -40,9 +40,6 @@ export class NotificationEntityService implements OnModuleInit { @Inject(DI.followRequestsRepository) private followRequestsRepository: FollowRequestsRepository, - @Inject(DI.accessTokensRepository) - private accessTokensRepository: AccessTokensRepository, - //private userEntityService: UserEntityService, //private noteEntityService: NoteEntityService, //private customEmojiService: CustomEmojiService, @@ -69,7 +66,6 @@ export class NotificationEntityService implements OnModuleInit { }, ): Promise> { const notification = src; - const token = notification.appAccessTokenId ? await this.accessTokensRepository.findOneByOrFail({ id: notification.appAccessTokenId }) : null; const noteIfNeed = NOTE_REQUIRED_NOTIFICATION_TYPES.has(notification.type) && notification.noteId != null ? ( hint?.packedNotes != null ? hint.packedNotes.get(notification.noteId) @@ -100,8 +96,8 @@ export class NotificationEntityService implements OnModuleInit { } : {}), ...(notification.type === 'app' ? { body: notification.customBody, - header: notification.customHeader ?? token?.name, - icon: notification.customIcon ?? token?.iconUrl, + header: notification.customHeader, + icon: notification.customIcon, } : {}), }); } diff --git a/packages/backend/src/server/api/endpoints/notifications/create.ts b/packages/backend/src/server/api/endpoints/notifications/create.ts index 268628cf7..19bc6fa8d 100644 --- a/packages/backend/src/server/api/endpoints/notifications/create.ts +++ b/packages/backend/src/server/api/endpoints/notifications/create.ts @@ -42,8 +42,8 @@ export default class extends Endpoint { // eslint- this.notificationService.createNotification(user.id, 'app', { appAccessTokenId: token ? token.id : null, customBody: ps.body, - customHeader: ps.header, - customIcon: ps.icon, + customHeader: ps.header ?? token?.name, + customIcon: ps.icon ?? token?.iconUrl, }); }); }