logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: b7bbf42acda9b26bc084f6655d6bc6f1a4a1bac5
parent dc63aaf84f07a6f8042f43617d8ec356fed85cec
Author: Alex Gleason <alex@alexgleason.me>
Date:   Fri, 13 Aug 2021 10:25:42 -0500

Streamer: fix crash in MastodonAPI.StatusView

Diffstat:

Mlib/pleroma/web/mastodon_api/views/status_view.ex14+++++++++++---
1 file 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 @@ -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]