ensure we can't have a null in appends
authorFloatingGhost <hannah@coffee-and-dreams.uk>
Sat, 11 Mar 2023 17:24:49 +0000 (17:24 +0000)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Sat, 11 Mar 2023 17:24:49 +0000 (17:24 +0000)
lib/pleroma/web/mastodon_api/views/status_view.ex

index 79438571cd26a5dbcebd58f0182456040e117e9c..3868da8d9310c96ec33fcf65230e5eea2552e423 100644 (file)
@@ -227,8 +227,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
         |> Enum.filter(fn tag -> is_map(tag) and tag["type"] == "Mention" end)
         |> Enum.map(fn tag -> tag["href"] end)
 
+      to_data = if is_nil(object.data["to"]), do: [], else: object.data["to"]
+
       mentions =
-        (object.data["to"] ++ tag_mentions)
+        (to_data ++ tag_mentions)
         |> Enum.uniq()
         |> Enum.map(fn
           Pleroma.Constants.as_public() -> nil