fix undefined image description, fix #632
This commit is contained in:
parent
c4de387f86
commit
d2221d539c
|
@ -1,5 +1,5 @@
|
|||
<div class="image">
|
||||
<div class="image__alt" *ngIf="displayAltLabel">ALT</div>
|
||||
<div class="image__alt" *ngIf="displayAltLabel && attachment.description" title="{{ attachment.description }}">ALT</div>
|
||||
<a *ngIf="status" href class="image__status" (click)="openStatus()" (auxclick)="openStatus()" title="open status">
|
||||
<fa-icon class="image__status--icon" [icon]="faExternalLinkAlt"></fa-icon>
|
||||
</a>
|
||||
|
|
|
@ -398,11 +398,13 @@ export class MastodonService {
|
|||
uploadMediaAttachment(account: AccountInfo, file: File, description: string): Promise<Attachment> {
|
||||
let input = new FormData();
|
||||
input.append('file', file);
|
||||
|
||||
if (description !== null && description !== undefined) {
|
||||
input.append('description', description);
|
||||
} else {
|
||||
input.append('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();
|
||||
|
@ -411,7 +413,13 @@ export class MastodonService {
|
|||
//TODO: add focus support
|
||||
updateMediaAttachment(account: AccountInfo, mediaId: string, description: string): Promise<Attachment> {
|
||||
let input = new FormData();
|
||||
input.append('description', description);
|
||||
|
||||
if (description !== null && description !== undefined) {
|
||||
input.append('description', description);
|
||||
} else {
|
||||
input.append('description', '');
|
||||
}
|
||||
|
||||
const route = `https://${account.instance}${this.apiRoutes.updateMediaAttachment.replace('{0}', mediaId)}`;
|
||||
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
|
||||
return this.httpClient.put<Attachment>(route, input, { headers: headers }).toPromise();
|
||||
|
|
Loading…
Reference in New Issue