diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts index 76057ef0a..1bff3aa4c 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/status.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts @@ -67,6 +67,25 @@ export function apiStatusMastodon(router: Router): void { const { sensitive } = body; body.sensitive = typeof sensitive === "string" ? sensitive === "true" : sensitive; + + if (body.poll) { + if ( + body.poll.expires_in != null && + typeof body.poll.expires_in === "string" + ) + body.poll.expires_in = parseInt(body.poll.expires_in); + if ( + body.poll.multiple != null && + typeof body.poll.multiple === "string" + ) + body.poll.multiple = body.poll.multiple == "true"; + if ( + body.poll.hide_totals != null && + typeof body.poll.hide_totals === "string" + ) + body.poll.hide_totals = body.poll.hide_totals == "true"; + } + const data = await client.postStatus(text, body); ctx.body = convertStatus(data.data); } catch (e: any) { diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index 1c15acf38..7ff802dc8 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -1169,7 +1169,7 @@ export default class Misskey implements MegalodonInterface { let pollParam = { choices: options.poll.options, expiresAt: null, - expiredAfter: options.poll.expires_in + expiredAfter: options.poll.expires_in * 1000 } if (options.poll.multiple !== undefined) { pollParam = Object.assign(pollParam, {