[mastodon-client] Fix polls param

This commit is contained in:
Laura Hausmann 2023-10-08 01:41:25 +02:00
parent 0f17691f00
commit db95d9a7f3
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -219,14 +219,14 @@ export function setupEndpointsStatus(router: Router): void {
router.get<{ Params: { id: string } }>("/v1/polls/:id", router.get<{ Params: { id: string } }>("/v1/polls/:id",
auth(false, ["read:statuses"]), auth(false, ["read:statuses"]),
async (ctx) => { async (ctx) => {
const note = await NoteHelpers.getNoteOr404(ctx.params.name, ctx); const note = await NoteHelpers.getNoteOr404(ctx.params.id, ctx);
ctx.body = await PollHelpers.getPoll(note, ctx); ctx.body = await PollHelpers.getPoll(note, ctx);
}); });
router.post<{ Params: { id: string } }>( router.post<{ Params: { id: string } }>(
"/v1/polls/:id/votes", "/v1/polls/:id/votes",
auth(true, ["write:statuses"]), auth(true, ["write:statuses"]),
async (ctx) => { async (ctx) => {
const note = await NoteHelpers.getNoteOr404(ctx.params.name, ctx); const note = await NoteHelpers.getNoteOr404(ctx.params.id, ctx);
const body: any = ctx.request.body; const body: any = ctx.request.body;
const choices = toArray(body.choices ?? []).map(p => parseInt(p)); const choices = toArray(body.choices ?? []).map(p => parseInt(p));