diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2021-08-29 18:48:53 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2021-08-29 18:48:53 +0000 |
commit | 0b2119d4a791b3623b304b0bab683609d23271d4 (patch) | |
tree | 40eac155fc0b26d924aa072fd289fc3e64bfad26 /lib/pleroma/web/mastodon_api/views/status_view.ex | |
parent | dc63aaf84f07a6f8042f43617d8ec356fed85cec (diff) | |
parent | 7372609c5b5063d177715d5067654888f7075403 (diff) |
Merge branch 'release/2.4.1' into 'stable'v2.4.1
Release: 2.4.1
See merge request pleroma/pleroma!3501
Diffstat (limited to 'lib/pleroma/web/mastodon_api/views/status_view.ex')
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/status_view.ex | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index da44e0a74..463f34198 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -65,11 +65,19 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do defp get_context_id(_), do: nil - defp reblogged?(activity, user) do - object = Object.normalize(activity, fetch: false) || %{} - present?(user && user.ap_id in (object.data["announcements"] || [])) + # Check if the user reblogged this status + defp reblogged?(activity, %User{ap_id: ap_id}) do + with %Object{data: %{"announcements" => announcements}} when is_list(announcements) <- + Object.normalize(activity, fetch: false) do + ap_id in announcements + else + _ -> false + end end + # False if the user is logged out + defp reblogged?(_activity, _user), do: false + def render("index.json", opts) do reading_user = opts[:for] |