diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-13 00:07:16 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-13 00:07:16 +0900 |
| commit | 0cf7c76d2c1f34e331a70b104c6bbd6468b09ebb (patch) | |
| tree | f8b5d8f6a9c1b87a17989de46e1b834809950a68 /src/models/note.ts | |
| parent | Add home customize link (diff) | |
| parent | wip (diff) | |
| download | misskey-0cf7c76d2c1f34e331a70b104c6bbd6468b09ebb.tar.gz misskey-0cf7c76d2c1f34e331a70b104c6bbd6468b09ebb.tar.bz2 misskey-0cf7c76d2c1f34e331a70b104c6bbd6468b09ebb.zip | |
Merge branch 'master' of https://github.com/syuilo/misskey
Diffstat (limited to 'src/models/note.ts')
| -rw-r--r-- | src/models/note.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/models/note.ts b/src/models/note.ts index 6e7b6cee79..3c1c2e18e1 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -5,12 +5,13 @@ import db from '../db/mongodb'; import { IUser, pack as packUser } from './user'; import { pack as packApp } from './app'; import { pack as packChannel } from './channel'; -import Vote from './poll-vote'; +import Vote, { deletePollVote } from './poll-vote'; import Reaction, { deleteNoteReaction } from './note-reaction'; import { pack as packFile } from './drive-file'; import NoteWatching, { deleteNoteWatching } from './note-watching'; import NoteReaction from './note-reaction'; import Favorite, { deleteFavorite } from './favorite'; +import PollVote from './poll-vote'; const Note = db.get<INote>('notes'); @@ -113,6 +114,11 @@ export async function deleteNote(note: string | mongo.ObjectID | INote) { await NoteReaction.find({ noteId: n._id }) ).map(x => deleteNoteReaction(x))); + // この投稿に対するPollVoteをすべて削除 + await Promise.all(( + await PollVote.find({ noteId: n._id }) + ).map(x => deletePollVote(x))); + // この投稿に対するFavoriteをすべて削除 await Promise.all(( await Favorite.find({ noteId: n._id }) |