diff --git a/package.json b/package.json index 755b085a..aa924475 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sengi", - "version": "1.0.0", + "version": "1.0.1", "license": "AGPL-3.0-or-later", "main": "main-electron.js", "description": "A multi-account desktop client for Mastodon and Pleroma", diff --git a/src/app/services/mastodon.service.ts b/src/app/services/mastodon.service.ts index 78a89f18..4c5c7a3f 100644 --- a/src/app/services/mastodon.service.ts +++ b/src/app/services/mastodon.service.ts @@ -357,7 +357,11 @@ export class MastodonService { createList(account: AccountInfo, title: string): Promise { let route = `https://${account.instance}${this.apiRoutes.postList}?title=${title}`; const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` }); - return this.httpClient.post(route, null, { headers: headers }).toPromise() + + let data = new ListData(); + data.title = title; + + return this.httpClient.post(route, data, { headers: headers }).toPromise() .then((list: List) => { return new StreamElement(StreamTypeEnum.list, list.title, account.id, null, list.title, list.id, account.instance); }); @@ -378,8 +382,12 @@ export class MastodonService { addAccountToList(account: AccountInfo, listId: string, accountId: number): Promise { let route = `https://${account.instance}${this.apiRoutes.addAccountToList}`.replace('{0}', listId); route += `?account_ids[]=${accountId}`; + + let data = new ListAccountData(); + data.account_ids.push(accountId.toString()); + 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(); } removeAccountFromList(account: AccountInfo, listId: string, accountId: number): Promise { @@ -543,6 +551,15 @@ class PollData { choices: number[]; } +class ListData { + title: string; + replies_policy: string = 'list'; //TODO +} + +class ListAccountData { + account_ids: string[] = []; +} + class StatusData { status: string; in_reply_to_id: string;