Skip to content

Commit

Permalink
fix(mastodon): only inject description field when alt text exists (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgrasset authored Oct 29, 2023
1 parent 4ea135f commit 6571eb0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/services/mastodon-sender.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@ export const mastodonSenderService = async (
log.text = `medias: ↑ (${mediaAttachments.length + 1}/${
medias.length
}) uploading`;
const m: {
file: unknown;
description?: string | null;
} = {
file: mediaBlob,
};
if (media.type === "image" && media.alt_text) {
m.description = media.alt_text;
}
await client.v2.media
.create({
file: mediaBlob,
description:
media.type === "image" && media.alt_text ? media.alt_text : null,
})
.create(m)
.then(async (mediaSent) => {
mediaAttachments.push(mediaSent);
})
Expand Down

0 comments on commit 6571eb0

Please sign in to comment.