summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcin mikołajczak <git@mkljczk.pl>2024-04-04 14:26:55 +0200
committerMark Felder <feld@feld.me>2024-05-08 13:40:26 -0400
commit818d9f7b636e8de996f1656eb9bc2f3100889257 (patch)
tree5d2a7f8bc69580280339aca7fa1caa44fc90d4f2
parent8eea4f58c7ae1618aec9f0c6a62e16771c34b787 (diff)
downloadpleroma-818d9f7b636e8de996f1656eb9bc2f3100889257.tar.gz
pleroma-818d9f7b636e8de996f1656eb9bc2f3100889257.zip
Include image description in status media cards
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
-rw-r--r--changelog.d/card-image-description.add1
-rw-r--r--lib/pleroma/web/api_spec/schemas/status.ex4
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex1
3 files changed, 6 insertions, 0 deletions
diff --git a/changelog.d/card-image-description.add b/changelog.d/card-image-description.add
new file mode 100644
index 000000000..bf423ebb8
--- /dev/null
+++ b/changelog.d/card-image-description.add
@@ -0,0 +1 @@
+Include image description in status media cards \ No newline at end of file
diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex
index a4052803b..6e537b5da 100644
--- a/lib/pleroma/web/api_spec/schemas/status.ex
+++ b/lib/pleroma/web/api_spec/schemas/status.ex
@@ -58,6 +58,10 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
format: :uri,
description: "Preview thumbnail"
},
+ image_description: %Schema{
+ type: :string,
+ description: "Alternate text that describes what is in the thumbnail"
+ },
title: %Schema{type: :string, description: "Title of linked resource"},
description: %Schema{type: :string, description: "Description of preview"}
}
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 77af69eef..c945290c1 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -583,6 +583,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
url: page_url,
image: image_url,
+ image_description: rich_media["image:alt"] || "",
title: rich_media["title"] || "",
description: rich_media["description"] || "",
pleroma: %{