include description when migrating media
This commit is contained in:
parent
1a1f4dccf6
commit
b4fdce6e66
|
@ -192,9 +192,10 @@ export class MastodonService {
|
|||
|
||||
}
|
||||
|
||||
uploadMediaAttachment(account: AccountInfo, file: File): Promise<Attachment> {
|
||||
uploadMediaAttachment(account: AccountInfo, file: File, description: string): Promise<Attachment> {
|
||||
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<Attachment>(route, input, { headers: headers }).toPromise();
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue