From 476bfbe24e8c9e0f07394c4725604a1e4409038c Mon Sep 17 00:00:00 2001 From: mei23 Date: Mon, 21 Jan 2019 04:55:02 +0900 Subject: [PATCH] Revert "Send Update" This reverts commit 171b046de549f1478e928dee3177eeefab341fcf. --- src/server/api/endpoints/notes/polls/vote.ts | 3 -- src/services/note/polls/vote.ts | 36 +------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src/server/api/endpoints/notes/polls/vote.ts b/src/server/api/endpoints/notes/polls/vote.ts index 15894ccef4..78dd1d1ff7 100644 --- a/src/server/api/endpoints/notes/polls/vote.ts +++ b/src/server/api/endpoints/notes/polls/vote.ts @@ -7,7 +7,6 @@ import { publishNoteStream } from '../../../../../stream'; import notify from '../../../../../notify'; import define from '../../../define'; import createNote from '../../../../../services/note/create'; -import { publishVoteToFollowers } from '../../../../../services/note/polls/vote'; export const meta = { desc: { @@ -125,6 +124,4 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { reply: note, }); } - - publishVoteToFollowers(user, note); })); diff --git a/src/services/note/polls/vote.ts b/src/services/note/polls/vote.ts index 786e3c4a86..8f8fb40000 100644 --- a/src/services/note/polls/vote.ts +++ b/src/services/note/polls/vote.ts @@ -5,12 +5,7 @@ import watch from '../../../services/note/watch'; import { publishNoteStream } from '../../../stream'; import notify from '../../../notify'; import createNote from '../../../services/note/create'; -import { isLocalUser, IUser, isRemoteUser } from '../../../models/user'; -import Following from '../../../models/following'; -import packAp from '../../../remote/activitypub/renderer'; -import { deliver } from '../../../queue'; -import renderUpdate from '../../../remote/activitypub/renderer/update'; -import renderQuestion from '../../../remote/activitypub/renderer/question'; +import { isLocalUser, 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'); @@ -89,33 +84,4 @@ export default (user: IUser, note: INote, choice: number) => new Promise(async ( reply: note, }); } - - publishVoteToFollowers(user, note); }); - -export async function publishVoteToFollowers(user: IUser, note: INote) { - const followers = await Following.find({ - followeeId: user._id - }); - - const queue: string[] = []; - - // フォロワーがリモートユーザーかつ投稿者がローカルユーザーならUpdateを配信 - if (isLocalUser(user)) { - for (const following of followers) { - const follower = following._follower; - - if (isRemoteUser(follower)) { - const inbox = follower.sharedInbox || follower.inbox; - if (!queue.includes(inbox)) queue.push(inbox); - } - } - - if (queue.length > 0) { - const content = packAp(renderUpdate(await renderQuestion(user, note), user)); - for (const inbox of queue) { - deliver(user, content, inbox); - } - } - } -}