diff --git a/packages/backend/src/queue/processors/ended-poll-notification.ts b/packages/backend/src/queue/processors/ended-poll-notification.ts index 9fe57d8da..e3d860ac8 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 73589125b..3d2ec0b07 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 0558aa1b8..40535d340 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); });