mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-01-03 05:48:42 +00:00
Include image description in status media cards
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
987f44d811
commit
6f6bede900
5 changed files with 10 additions and 1 deletions
1
changelog.d/card-image-description.add
Normal file
1
changelog.d/card-image-description.add
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Include image description in status media cards
|
|
@ -58,6 +58,10 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
|
||||||
format: :uri,
|
format: :uri,
|
||||||
description: "Preview thumbnail"
|
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"},
|
title: %Schema{type: :string, description: "Title of linked resource"},
|
||||||
description: %Schema{type: :string, description: "Description of preview"}
|
description: %Schema{type: :string, description: "Description of preview"}
|
||||||
}
|
}
|
||||||
|
|
|
@ -589,6 +589,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
|
provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
|
||||||
url: page_url,
|
url: page_url,
|
||||||
image: image_url,
|
image: image_url,
|
||||||
|
image_description: rich_media["image:alt"] || "",
|
||||||
title: rich_media["title"] || "",
|
title: rich_media["title"] || "",
|
||||||
description: rich_media["description"] || "",
|
description: rich_media["description"] || "",
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
|
|
@ -1717,6 +1717,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
||||||
|
|
||||||
card_data = %{
|
card_data = %{
|
||||||
"image" => "http://ia.media-imdb.com/images/rock.jpg",
|
"image" => "http://ia.media-imdb.com/images/rock.jpg",
|
||||||
|
"image_description" => "",
|
||||||
"provider_name" => "example.com",
|
"provider_name" => "example.com",
|
||||||
"provider_url" => "https://example.com",
|
"provider_url" => "https://example.com",
|
||||||
"title" => "The Rock",
|
"title" => "The Rock",
|
||||||
|
@ -1770,6 +1771,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
||||||
"title" => "Pleroma",
|
"title" => "Pleroma",
|
||||||
"description" => "",
|
"description" => "",
|
||||||
"image" => nil,
|
"image" => nil,
|
||||||
|
"image_description" => "",
|
||||||
"provider_name" => "example.com",
|
"provider_name" => "example.com",
|
||||||
"provider_url" => "https://example.com",
|
"provider_url" => "https://example.com",
|
||||||
"url" => "https://example.com/ogp-missing-data",
|
"url" => "https://example.com/ogp-missing-data",
|
||||||
|
|
|
@ -773,6 +773,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
page_url = "http://example.com"
|
page_url = "http://example.com"
|
||||||
|
|
||||||
card = %{
|
card = %{
|
||||||
|
"image:alt" => "Example image description",
|
||||||
url: page_url,
|
url: page_url,
|
||||||
site_name: "Example site name",
|
site_name: "Example site name",
|
||||||
title: "Example website",
|
title: "Example website",
|
||||||
|
@ -780,7 +781,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
||||||
description: "Example description"
|
description: "Example description"
|
||||||
}
|
}
|
||||||
|
|
||||||
%{provider_name: "example.com"} =
|
%{provider_name: "example.com", image_description: "Example image description"} =
|
||||||
StatusView.render("card.json", %{page_url: page_url, rich_media: card})
|
StatusView.render("card.json", %{page_url: page_url, rich_media: card})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue