This commit is contained in:
Roman Chvanikov 2020-12-09 00:49:28 +03:00
parent 07e80e39b1
commit d960d926a0

View File

@ -165,10 +165,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp maybe_update_media(%Object{data: %{"attachment" => []}}), do: :ok
defp maybe_update_media(%Object{id: id, data: %{"attachment" => attachments}}) do
Enum.each(attachments, fn %{"id" => media_id} ->
media_id
|> Pleroma.Media.get_by_id()
|> Pleroma.Media.update(%{object_id: id})
Enum.each(attachments, fn data ->
with %{"id" => media_id} <- data do
media_id
|> Pleroma.Media.get_by_id()
|> Pleroma.Media.update(%{object_id: id})
end
end)
end