Skip to content

Patch to support image decriptions in the Mastodon front-end

An Darna requested to merge andarna/pleroma:patch-add-image-description into develop

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 the put request for the description
  • In web/mastodon_api/mastodon_api_controller.ex:362, added a handler add_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 field description: 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.

Merge request reports

Loading