From 00290fbf75859055422ff6239f6a55425981ebfe Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 19 Oct 2018 06:29:25 +0900 Subject: [PATCH] Fix bug --- src/services/note/delete.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/services/note/delete.ts b/src/services/note/delete.ts index 2b99b4b85e..4b0f482c08 100644 --- a/src/services/note/delete.ts +++ b/src/services/note/delete.ts @@ -8,6 +8,8 @@ import Following from '../../models/following'; import renderTombstone from '../../remote/activitypub/renderer/tombstone'; import { updateNoteStats } from '../update-chart'; import config from '../../config'; +import NoteUnread from '../../models/note-unread'; +import read from './read'; /** * 投稿を削除します。 @@ -36,6 +38,15 @@ export default async function(user: IUser, note: INote) { deletedAt: deletedAt }); + // この投稿が関わる未読通知を削除 + NoteUnread.find({ + noteId: note._id + }).then(unreads => { + unreads.forEach(unread => { + read(unread.userId, unread.noteId); + }); + }); + //#region ローカルの投稿なら削除アクティビティを配送 if (isLocalUser(user)) { const content = pack(renderDelete(renderTombstone(`${config.url}/notes/${note._id}`), user));