From 68cc264f5f25353fbd5df3ccb23cfe5a93c49564 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Sun, 18 Jun 2023 12:51:51 -0400 Subject: [PATCH] don't broadcast poll updates --- .../src/queue/processors/ended-poll-notification.ts | 7 +++++-- packages/backend/src/remote/activitypub/models/note.ts | 4 ---- .../backend/src/server/api/endpoints/notes/polls/vote.ts | 4 ---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/queue/processors/ended-poll-notification.ts b/packages/backend/src/queue/processors/ended-poll-notification.ts index 9fe57d8da3..e3d860ac82 100644 --- a/packages/backend/src/queue/processors/ended-poll-notification.ts +++ b/packages/backend/src/queue/processors/ended-poll-notification.ts @@ -1,9 +1,9 @@ import type Bull from "bull"; -import { In } from "typeorm"; -import { Notes, Polls, PollVotes } from "@/models/index.js"; +import { Notes, PollVotes } from "@/models/index.js"; import { queueLogger } from "../logger.js"; import type { EndedPollNotificationJobData } from "@/queue/types.js"; import { createNotification } from "@/services/create-notification.js"; +import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; const logger = queueLogger.createSubLogger("ended-poll-notification"); @@ -32,5 +32,8 @@ export async function endedPollNotification( }); } + // Broadcast the poll result once it ends + await deliverQuestionUpdate(note.id); + done(); } diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index 73589125b4..3d2ec0b07b 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -17,7 +17,6 @@ import { extractPollFromQuestion, updateQuestion } from "./question.js"; import vote from "@/services/note/polls/vote.js"; import { apLogger } from "../logger.js"; import { DriveFile } from "@/models/entities/drive-file.js"; -import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; import { extractDbHost, toPuny } from "@/misc/convert-host.js"; import { Emojis, @@ -334,9 +333,6 @@ export async function createNote( `vote from AP: actor=${actor.username}@${actor.host}, note=${note.id}, choice=${name}`, ); await vote(actor, reply, index); - - // リモートフォロワーにUpdate配信 - deliverQuestionUpdate(reply.id); } return null; }; diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 0558aa1b8f..40535d3401 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -4,7 +4,6 @@ import { createNotification } from "@/services/create-notification.js"; import { deliver } from "@/queue/index.js"; import { renderActivity } from "@/remote/activitypub/renderer/index.js"; import renderVote from "@/remote/activitypub/renderer/vote.js"; -import { deliverQuestionUpdate } from "@/services/note/polls/update.js"; import { PollVotes, NoteWatchings, @@ -178,7 +177,4 @@ export default define(meta, paramDef, async (ps, user) => { pollOwner.inbox, ); } - - // リモートフォロワーにUpdate配信 - deliverQuestionUpdate(note.id); });