X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Fstatus_view.ex;h=c0e289ef8013b7ed3a1e6a1b9a84e0ed2ff627cd;hb=1d94b67e409010e4da20b4d325813390d9d8bb73;hp=b14ca9f5d65a59a4dab62b89868424182979486a;hpb=d03a116654bd7c4329b698a0f175e37aea8c2caa;p=akkoma diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index b14ca9f5d..c0e289ef8 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -87,6 +87,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do favourites_count: 0, reblogged: false, favourited: false, + bookmarked: false, muted: false, pinned: pinned?(activity, user), sensitive: false, @@ -121,6 +122,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do repeated = opts[:for] && opts[:for].ap_id in (object["announcements"] || []) favorited = opts[:for] && opts[:for].ap_id in (object["likes"] || []) + bookmarked = opts[:for] && object["id"] in opts[:for].bookmarks attachment_data = object["attachment"] || [] attachments = render_many(attachment_data, StatusView, "attachment.json", as: :attachment) @@ -157,6 +159,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do favourites_count: like_count, reblogged: present?(repeated), favourited: present?(favorited), + bookmarked: present?(bookmarked), muted: false, pinned: pinned?(activity, user), sensitive: sensitive, @@ -179,8 +182,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do end def render("card.json", %{rich_media: rich_media, page_url: page_url}) do - page_url = rich_media[:url] || page_url - page_url_data = URI.parse(page_url) + page_url_data = + if rich_media[:url] != nil do + URI.merge(URI.parse(page_url), URI.parse(rich_media[:url])) + else + page_url + end + + page_url = page_url_data |> to_string + + image_url = + if rich_media[:image] != nil do + URI.merge(page_url_data, URI.parse(rich_media[:image])) + |> to_string + else + nil + end + site_name = rich_media[:site_name] || page_url_data.host %{ @@ -188,7 +206,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do provider_name: site_name, provider_url: page_url_data.scheme <> "://" <> page_url_data.host, url: page_url, - image: rich_media[:image] |> MediaProxy.url(), + image: image_url |> MediaProxy.url(), title: rich_media[:title], description: rich_media[:description], pleroma: %{