aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2021-08-13 15:42:12 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2021-08-13 15:42:12 +0000
commit61ba54897ee727527b31c5f18ac599a7f788d63b (patch)
treed6e60d8ea3129221b368af4275e4160aeddde57d
parent21720db8596a50d84200db5c564267cfe992580d (diff)
parentb7bbf42acda9b26bc084f6655d6bc6f1a4a1bac5 (diff)
downloadpleroma-61ba54897ee727527b31c5f18ac599a7f788d63b.tar.gz
Merge branch 'streamer-crash-fix' into 'develop'
Streamer crash fix See merge request pleroma/pleroma!3508
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex14
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]