This commit is contained in:
syuilo 2023-11-02 15:31:15 +09:00
parent 314fb4bfd9
commit 29b06994a2
3 changed files with 12 additions and 14 deletions

View File

@ -100,17 +100,14 @@ class NotificationManager {
} }
@bindThis @bindThis
public async deliver() { public async notify() {
for (const x of this.queue) { for (const x of this.queue) {
// ミュート情報を取得 if (x.reason === 'renote') {
const mentioneeMutes = await this.mutingsRepository.findBy({ this.notificationService.createNotification(x.target, 'renote', {
muterId: x.target, noteId: this.note.id,
}); targetNoteId: this.note.renoteId!,
}, this.notifier.id);
const mentioneesMutedUserIds = mentioneeMutes.map(m => m.muteeId); } else {
// 通知される側のユーザーが通知する側のユーザーをミュートしていない限りは通知する
if (!mentioneesMutedUserIds.includes(this.notifier.id)) {
this.notificationService.createNotification(x.target, x.reason, { this.notificationService.createNotification(x.target, x.reason, {
noteId: this.note.id, noteId: this.note.id,
}, this.notifier.id); }, this.notifier.id);
@ -642,7 +639,7 @@ export class NoteCreateService implements OnApplicationShutdown {
} }
} }
nm.deliver(); nm.notify();
//#region AP deliver //#region AP deliver
if (this.userEntityService.isLocalUser(user)) { if (this.userEntityService.isLocalUser(user)) {

View File

@ -38,6 +38,7 @@ export type MiNotification = {
createdAt: string; createdAt: string;
notifierId: MiUser['id']; notifierId: MiUser['id'];
noteId: MiNote['id']; noteId: MiNote['id'];
targetNoteId: MiNote['id'];
} | { } | {
type: 'quote'; type: 'quote';
id: string; id: string;

View File

@ -142,15 +142,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
prevGroupedNotification.id = notification.id; prevGroupedNotification.id = notification.id;
continue; continue;
} }
if (prev.type === 'renote' && notification.type === 'renote' && prev.noteId === notification.noteId) { if (prev.type === 'renote' && notification.type === 'renote' && prev.targetNoteId === notification.targetNoteId) {
if (prevGroupedNotification.type !== 'renote:grouped') { if (prevGroupedNotification.type !== 'renote:grouped') {
groupedNotifications.push({ groupedNotifications[groupedNotifications.length - 1] = {
type: 'renote:grouped', type: 'renote:grouped',
id: '', id: '',
createdAt: notification.createdAt, createdAt: notification.createdAt,
noteId: prev.noteId!, noteId: prev.noteId!,
userIds: [], userIds: [],
}); };
prevGroupedNotification = groupedNotifications.at(-1)!; prevGroupedNotification = groupedNotifications.at(-1)!;
} }
(prevGroupedNotification as FilterUnionByProperty<MiGroupedNotification, 'type', 'renote:grouped'>).userIds.push(notification.notifierId!); (prevGroupedNotification as FilterUnionByProperty<MiGroupedNotification, 'type', 'renote:grouped'>).userIds.push(notification.notifierId!);