fix(backend): アクセストークンを削除すると、通知が取得できなくなる場合がある問題を修正

This commit is contained in:
syuilo 2023-10-31 11:45:03 +09:00
parent 56c5da97e6
commit a35fe29ef4
3 changed files with 6 additions and 9 deletions

View file

@ -60,6 +60,7 @@
- Fix: `hashtags/trend`にてRedisからトレンドの情報が取得できない際にInternal Server Errorになる問題を修正
- Fix: HTLをリロードまたは遡行したとき、フォローしているチャンネルのートが含まれない問題を修正 #11765 #12181
- Fix: リノートをリノートできるのを修正
- Fix: アクセストークンを削除すると、通知が取得できなくなる場合がある問題を修正
## 2023.10.2

View file

@ -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<Packed<'Notification'>> {
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,
} : {}),
});
}

View file

@ -42,8 +42,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // 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,
});
});
}