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
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