Federate correct activity

This commit is contained in:
Francis Dinh 2018-05-08 21:52:21 -04:00
parent 8b4ee0ea51
commit 4d5ec883b7
2 changed files with 13 additions and 7 deletions

View 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

View 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