diff --git a/src/services/note/polls/vote.ts b/src/services/note/polls/vote.ts index 8f8fb40000..d4dbbc8965 100644 --- a/src/services/note/polls/vote.ts +++ b/src/services/note/polls/vote.ts @@ -1,11 +1,6 @@ import Vote from '../../../models/poll-vote'; import Note, { INote } from '../../../models/note'; -import Watching from '../../../models/note-watching'; -import watch from '../../../services/note/watch'; -import { publishNoteStream } from '../../../stream'; -import notify from '../../../notify'; -import createNote from '../../../services/note/create'; -import { isLocalUser, IUser } from '../../../models/user'; +import { IUser } from '../../../models/user'; export default (user: IUser, note: INote, choice: number) => new Promise(async (res, rej) => { if (!note.poll.choices.some(x => x.id == choice)) return rej('invalid choice param'); @@ -38,50 +33,4 @@ export default (user: IUser, note: INote, choice: number) => new Promise(async ( await Note.update({ _id: note._id }, { $inc: inc }); - - publishNoteStream(note._id, 'pollVoted', { - choice: choice, - userId: user._id.toHexString() - }); - - // Notify - notify(note.userId, user._id, 'poll_vote', { - noteId: note._id, - choice: choice - }); - - // Fetch watchers - Watching - .find({ - noteId: note._id, - userId: { $ne: user._id }, - // 削除されたドキュメントは除く - deletedAt: { $exists: false } - }, { - fields: { - userId: true - } - }) - .then(watchers => { - for (const watcher of watchers) { - notify(watcher.userId, user._id, 'poll_vote', { - noteId: note._id, - choice: choice - }); - } - }); - - // ローカルユーザーが投票した場合この投稿をWatchする - if (isLocalUser(user) && user.settings.autoWatch !== false) { - watch(user._id, note); - } - - // ローカルからリモートへの投票の場合リプライ送信 - if (isLocalUser(user) && note._user.host != null) { - createNote(user, { - createdAt: new Date(), - text: choice.toString(), - reply: note, - }); - } });