From d74b0306882b4375ba56a96099c5e9d6f9c61042 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Tue, 22 Dec 2020 19:55:12 -0500 Subject: [PATCH] fix poll vote in pleroma --- src/app/services/mastodon.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/services/mastodon.service.ts b/src/app/services/mastodon.service.ts index f5e5973d..78a89f18 100644 --- a/src/app/services/mastodon.service.ts +++ b/src/app/services/mastodon.service.ts @@ -393,8 +393,11 @@ export class MastodonService { let route = `https://${account.instance}${this.apiRoutes.voteOnPoll}`.replace('{0}', pollId); route += `?${this.formatArray(pollSelection.map(x => x.toString()), 'choices')}`; + let data = new PollData(); + data.choices = pollSelection; + const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` }); - return this.httpClient.post(route, null, { headers: headers }).toPromise(); + return this.httpClient.post(route, data, { headers: headers }).toPromise(); } getPoll(account: AccountInfo, pollId: string): Promise { @@ -536,6 +539,10 @@ export enum VisibilityEnum { Direct = 4 } +class PollData { + choices: number[]; +} + class StatusData { status: string; in_reply_to_id: string;