Patch to support image decriptions in the Mastodon front-end
To support image descriptions:
- In
upload.ex:22
, changed type to "Document" because with "Image", Mastodon does not show the alt text - In
web/router.ex:124
, created a route for theput
request for the description - In
web/mastodon_api/mastodon_api_controller.ex:362
, added a handleradd_description
for this route. This overwrites the "name" field with the description, like Mastodon does. It also adds a "description" field to the attachment json, this is used for rendering in the Mastodon FE. - In
web/mastodon_api/views/status_view.ex:204
, in render("attachment.json"), added fielddescription: attachment["name"]
I didn't add any test cases because I don't know how to do this, but I tested it to and from three different versions of Mastodon (2.2.0, 2.3.1 and 2.3.3), with multiple images.