Federate correct activity
authorFrancis Dinh <normandy@firemail.cc>
Wed, 9 May 2018 01:52:21 +0000 (21:52 -0400)
committerFrancis Dinh <normandy@firemail.cc>
Wed, 9 May 2018 01:52:21 +0000 (21:52 -0400)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/ostatus/activity_representer.ex

index 5f11b8410b336b342120a560ff23ab6dfaafb766..334cfcc5b15aabca6d87d911c2f4c042bd3c5ee4 100644 (file)
@@ -151,13 +151,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
         local \\ true,
         activity_id \\ nil
       ) do
-    with %Activity{} = activity <- get_existing_announce(actor.ap_id, object),
-         unannounce_data <- make_unannounce_data(actor, activity, activity_id),
+    with %Activity{} = announce_activity <- get_existing_announce(actor.ap_id, object),
+         unannounce_data <- make_unannounce_data(actor, announce_activity, activity_id),
          {:ok, unannounce_activity} <- insert(unannounce_data, local),
-         :ok <- maybe_federate(activity),
-         {:ok, _activity} <- Repo.delete(activity),
-         {:ok, object} <- remove_announce_from_object(activity, object) do
-      {:ok, unannounce_activity, activity, object}
+         :ok <- maybe_federate(unannounce_activity),
+         {:ok, _activity} <- Repo.delete(announce_activity),
+         {:ok, object} <- remove_announce_from_object(announce_activity, object) do
+      {:ok, unannounce_activity, announce_activity, object}
     else
       _e -> {:ok, object}
     end
index 921a89bd015fca545652f3c0f202996e0d220080..1e9d4a7fbb354ed7f7c93d55a791d3fd0cd18a91 100644 (file)
@@ -240,7 +240,13 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
     inserted_at = activity.data["published"]
 
     author = if with_author, do: [{:author, UserRepresenter.to_simple_form(user)}], else: []
-    follow_activity = Activity.get_by_ap_id(activity.data["object"])
+
+    follow_activity =
+      if is_map(activity.data["object"]) do
+        Activity.get_by_ap_id(activity.data["object"]["id"])
+      else
+        Activity.get_by_ap_id(activity.data["object"])
+      end
 
     mentions = (activity.recipients || []) |> get_mentions