activitypub: utils: rework make_flag_data to accept either activity payloads or IRIs
authorWilliam Pitcock <nenolod@dereferenced.org>
Thu, 14 Mar 2019 19:04:52 +0000 (19:04 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Thu, 14 Mar 2019 19:05:42 +0000 (19:05 +0000)
lib/pleroma/web/activity_pub/utils.ex

index 182f9cacbdbc8769bed2cacd36a3d6e605541c28..9881b7bbbc6b9886e243e7b218eb067187ecff25 100644 (file)
@@ -621,7 +621,12 @@ defmodule Pleroma.Web.ActivityPub.Utils do
   #### Flag-related helpers
 
   def make_flag_data(params, additional) do
-    status_ap_ids = Enum.map(params.statuses || [], & &1.data["id"])
+    status_ap_ids =
+      Enum.map(params.statuses || [], fn
+        act when is_map(act) -> act["id"]
+        act when is_binary(act) -> act
+      end)
+
     object = [params.account.ap_id] ++ status_ap_ids
 
     %{