From 8b5d8af9b0cc4d4ad0cf21de59827ff21df99560 Mon Sep 17 00:00:00 2001
From: mei23 <m@m544.net>
Date: Mon, 21 Jan 2019 05:41:52 +0900
Subject: [PATCH] =?UTF-8?q?AP=E3=81=8B=E3=82=89=E3=81=AB=E3=81=AF=E4=B8=8D?=
 =?UTF-8?q?=E8=A6=81=E3=81=AA=E5=87=A6=E7=90=86=E3=82=92=E5=89=8A=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/services/note/polls/vote.ts | 53 +--------------------------------
 1 file changed, 1 insertion(+), 52 deletions(-)

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,
-		});
-	}
 });