Fix delivery to CC.

This commit is contained in:
lain 2018-02-18 16:59:41 +01:00
parent 8567feed47
commit deaad6d97a
2 changed files with 4 additions and 3 deletions

View File

@ -280,10 +280,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
def publish(actor, activity) do def publish(actor, activity) do
{:ok, followers} = User.get_followers(actor) {:ok, followers} = User.get_followers(actor)
remote_inboxes = Pleroma.Web.Salmon.remote_users(activity) ++ followers remote_inboxes = (Pleroma.Web.Salmon.remote_users(activity) ++ followers)
|> Enum.filter(fn (user) -> User.ap_enabled?(user) end) |> Enum.filter(fn (user) -> User.ap_enabled?(user) end)
|> Enum.map(fn (%{info: %{"source_data" => data}}) -> |> Enum.map(fn (%{info: %{"source_data" => data}}) ->
(data["endpoints"] && data["endpoints"]["sharedInbox"]) ||data["inbox"] (data["endpoints"] && data["endpoints"]["sharedInbox"]) || data["inbox"]
end) end)
|> Enum.uniq |> Enum.uniq

View File

@ -138,7 +138,8 @@ defmodule Pleroma.Web.Salmon do
{:ok, salmon} {:ok, salmon}
end end
def remote_users(%{data: %{"to" => to}}) do def remote_users(%{data: %{"to" => to} = data}) do
to = to ++ (data["cc"] || [])
to to
|> Enum.map(fn(id) -> User.get_cached_by_ap_id(id) end) |> Enum.map(fn(id) -> User.get_cached_by_ap_id(id) end)
|> Enum.filter(fn(user) -> user && !user.local end) |> Enum.filter(fn(user) -> user && !user.local end)