diff --git a/src/app/services/mastodon.service.ts b/src/app/services/mastodon.service.ts index acb9a47a..195b1c38 100644 --- a/src/app/services/mastodon.service.ts +++ b/src/app/services/mastodon.service.ts @@ -192,9 +192,10 @@ export class MastodonService { } - uploadMediaAttachment(account: AccountInfo, file: File): Promise { + uploadMediaAttachment(account: AccountInfo, file: File, description: string): Promise { let input = new FormData(); input.append('file', file); + input.append('description', description); const route = `https://${account.instance}${this.apiRoutes.uploadMediaAttachment}`; const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` }); return this.httpClient.post(route, input, { headers: headers }).toPromise(); diff --git a/src/app/services/media.service.ts b/src/app/services/media.service.ts index 0d5e1105..c577f97e 100644 --- a/src/app/services/media.service.ts +++ b/src/app/services/media.service.ts @@ -31,7 +31,7 @@ export class MediaService { medias.push(wrapper); this.mediaSubject.next(medias); - this.mastodonService.uploadMediaAttachment(account, file) + this.mastodonService.uploadMediaAttachment(account, file, null) .then((attachment: Attachment) => { let currentMedias = this.mediaSubject.value; let currentMedia = currentMedias.filter(x => x.id === uniqueId)[0]; @@ -79,7 +79,7 @@ export class MediaService { this.mediaSubject.next(medias); for (let media of medias) { - this.mastodonService.uploadMediaAttachment(account, media.file) + this.mastodonService.uploadMediaAttachment(account, media.file, media.description) .then((attachment: Attachment) => { let currentMedias = this.mediaSubject.value; let currentMedia = currentMedias.filter(x => x.id === media.id)[0];